EWS Failed to find Autodiscover service

I am using C # EWS (ExchangeWebServices).
I have an ExchangeServer ie with the following IP: 10.81.5.1.
Now I'm trying to access ExchangeServer, as shown below:

 ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);

 service.Credentials = new WebCredentials("myuser", "mypassword", "10.81.5.1");
 service.TraceEnabled = true;
 service.TraceFlags = TraceFlags.All;
 service.AutodiscoverUrl("myuser@mydomain.local", RedirectionUrlValidationCallback);//Throw an exception

And I got the following exception:

Could not find the Autodiscover service.

How do I know my ExchangeServer domain?

When I changed the following (and ran the code inside the ExchangeServer machine)

service.Credentials = new WebCredentials("myuser", "mypassword");

The domain value is the local host. I successfully execute my code without exception.

What is the error in my code?

What do I need to write instead of "10.81.5.1" if I do not run the code inside the ExchangeServer machine? How can I find out my ExchangeServer domain?

Thank.

+4
3

, .
, :

 service.AutodiscoverUrl("myuser@mydomain.local", RedirectionUrlValidationCallback);//Throw an exception

uri.asmx EWS:

service.Url = new Uri("https://IP/EWS/Exchange.asmx");
+4

3 :

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials("<loginID..not email address>", "< the pw>");
service.AutodiscoverUrl("<your emailaddress>",RedirectionUrlValidationCallback);

- abc123. .

+2

On my machine (win7) I can find it here: Control Panel - System - Settings for the computer name, domain and workgroup. Perhaps you can try.

0
source

Source: https://habr.com/ru/post/1650877/


All Articles