交换网络服务错误 - 远程服务器返回错误不允许405方法 [英] exchange web service error - the remote server returned an error 405 method not allowed
本文介绍了交换网络服务错误 - 远程服务器返回错误不允许405方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过交换网络服务来发送邮件。我看着MSDN和寻找一些帮助。
每次我尝试运行这段代码,我发现了上面的错误:(
我尝试读取几乎无处不在......
ExchangeService服务=新ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials =新WebCredentials(我的用户名,我的通行证);
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((发件人,证书链,sslPolicyErrors)=> TRUE);
service.Url =新的URI(我的web服务url.WSDL);
EmailMessage任命=新EmailMessage(服务);
appointment.Subject =测试由我;
appointment.Body =DateTime.Now ;
appointment.ToRecipients.Add(xxxxxxx@gmail.com);
appointment.SendAnd
SaveCopy();
解决方案
在该URL设置到服务,你其实应该使用ASMX,而不是该WSDL链接
service.Url =新的URI(HTTPS://server/EWS/Exchange.asmx);
这应该使其工作。
I'm trying to send a mail via the exchange web service. I looked into the msdn and find some help. 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.
service.Url = new Uri("https://server/EWS/Exchange.asmx");
That should make it work.
这篇关于交换网络服务错误 - 远程服务器返回错误不允许405方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文