ssl - MVC Web 应用获取 Outlook 邮件失败,无法解析远程名称 'login.microsoftonline.com'

标签 ssl proxy outlook owin-middleware azure-authentication

我创建了 this tutorial 的示例应用程序

当我没有连接到 vpn 或工作相关网络时,它工作正常。一旦我登录失败并出现以下错误:

Application Error

我想这与 SSL 证书有关。我确实为 login.microsoftonline.com 站点安装了证书:

Certificate for microsoftonline

一定是证书出了问题,或者可能是代理问题?有没有人可以给我建议要寻找什么?

最佳答案

我已经能够解决这个问题,它与代理有关:

我将以下网站添加到我的信任网站列表中:

https://*.microsoft.com
https://*.microsoftonline.com
https://*.microsoftonline-p.com
https://*.outlook.com

我在项目的 web.config 文件中添加了以下内容:

  <system.net>
    <defaultProxy enabled="true" useDefaultCredentials="false">
      <module type = "<YourNameSpace>.MyProxy, <YourNameSpace>" />
    </defaultProxy>
  </system.net>

然后我添加了一个包含 MyProxy 代码的新类:

namespace <YourNameSpace>
{
    public class MyProxy : IWebProxy
    {
        public ICredentials Credentials
        {
            get { return new NetworkCredential(@"<UserName>", @"<Password>", @"<Domain(optional)>"); }
            set { }
        }

        public Uri GetProxy(Uri destination)
        {
            return new Uri("http://<YourProxy>:<Port>");
        }

        public bool IsBypassed(Uri host)
        {
            return false;
        }
    }
}

关于ssl - MVC Web 应用获取 Outlook 邮件失败,无法解析远程名称 'login.microsoftonline.com',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47694915/

相关文章:

展望 2013 : Adding button to reading pane?

java - 有没有办法使用 Zuul 代理内部 http 调用?

仅从移动设备显示 SSL 错误

ssl - 使用 Cloudflare 的共享 SSL 时,HTTP 应如何列在 Google 的 API 下?

tomcat - 如何在浏览器上显示根数字证书?

caching - NGINX try_files 具有多个命名位置

database - 将本地 SQLite 数据库与服务器 SQLite 数据库同步

c# - Outlook ItemAdd 事件针对新日历项目触发两次

c# - 电子邮件的显示选项

ssl - 在 WHM 的主域上使用 SSL