简体   繁体   English

交换Web服务错误-远程服务器返回不允许的错误405方法

[英]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.

相关问题 Azure移动服务,远程服务器返回错误:(405)不允许的方法 - Azure mobile service, The remote server returned an error: (405) Method Not Allowed 远程服务器返回错误:“(405) Method Not Allowed” - The remote server returned an error: "(405) Method Not Allowed" 远程服务器返回错误:(405)允许方法 - The remote server returned an error: (405) Method Allowed 远程服务器返回错误:(405)方法不允许 - The remote server returned an error: (405) Method Not Allowed 调用web api发布方法错误“远程服务器返回错误:(405)不允许使用方法” - calling web api Post method error “The remote server returned an error: (405) Method Not Allowed” 远程服务器返回错误:(405) Method Not Allowed service request and "Request method 'POST' not supported" - The remote server returned an error: (405) Method Not Allowed service request and "Request method 'POST' not supported" 远程服务器返回错误:(405)mvc 5中不允许使用方法 - The remote server returned an error: (405) Method Not Allowed in mvc 5 .NET,远程服务器返回错误:(405) Method Not Allowed - .NET , The remote server returned an error: (405) Method Not Allowed 远程服务器返回错误:(405) 在 expedia api 调用中不允许方法 - The remote server returned an error: (405) Method Not Allowed in expedia api call 远程服务器返回错误:(405)方法不允许。 WCF REST服务 - The remote server returned an error: (405) Method Not Allowed. WCF REST Service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM