The Autodiscover service couldn't be located - EWS API AutodiscoverUrl 報錯


使用EWS Managed API 進行郵件收取


提示為AutodiscoverUrl處異常, The Autodiscover service couldn't be located 。

在xp x86本地開發環境下代碼沒有問題,放到win2008x64上時報錯,說明與程序運行環境有關。

查閱官方文檔:Getting Started with the EWS Managed API 可得知,ssl可導致這個錯誤出現。

可根據官方文檔添加以下代碼:
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
// Hook up the cert callback.
System.Net.ServicePointManager.ServerCertificateValidationCallback =
delegate(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors)
{
// Validate the certificate and return true or false as appropriate.
// Note that it not a good practice to always return true because not
// all certificates should be trusted.
};



另,一網友也碰到了此問題,並附有解決方法:http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/bdc45cd8-6385-4900-9e40-23814beb7639?Thread%3Abdc45cd8-6385-4900-9e40-23814beb7639=Microsoft.Forums.Data.Models.Discussion&ThreadViewModel%3Abdc45cd8-6385-4900-9e40-23814beb7639=Microsoft.Forums.CachedViewModels.ThreadViewModel


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM