[英]exchange web service error - the remote server returned an error 405 method not allowed
I'm trying to send a mail via the exchange web service. 我正在尝试通过Exchange Web服务发送邮件。 I looked into the msdn and find some help.
我调查了msdn并找到了一些帮助。 Every time I try to run this code i'm getting the above error :( I try read almost everywhere...
每次我尝试运行此代码时,我都会收到上述错误:(我尝试在几乎所有地方阅读...
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("My user name", "my pass");
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
service.Url = new Uri("my web service url.WSDL");
EmailMessage appointment = new EmailMessage(service);
appointment.Subject = "Test by me";
appointment.Body = "DateTime.Now";
appointment.ToRecipients.Add("xxxxxxx@gmail.com");
appointment.SendAnd
SaveCopy();
When setting the url to the service, you should in fact use the asmx, and not the wsdl link. 设置服务的url时,实际上应该使用asmx,而不是wsdl链接。
service.Url = new Uri("https://server/EWS/Exchange.asmx");
That should make it work. 那应该使它工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.