【问题标题】:DotnetopenAuth throws a "ProtocolExceptionDotnetopenAuth 引发“ProtocolException
【发布时间】:2013-01-15 11:44:14
【问题描述】:

我正在尝试使用 ASP.NET MVC 实现 OpeinID 登录。我正在尝试按照http://blog.nerdbank.net/2008/04/add-openid-login-support-to-your-aspnet.html

中给出的步骤进行操作

下面是我的设置 web.config

<dotNetOpenAuth>
<messaging>
    <untrustedWebRequest>
        <whitelistHosts>
            <add name="localhost" />
        </whitelistHosts>
    </untrustedWebRequest>
</messaging>
<reporting enabled="false" />

<system.net>
<defaultProxy useDefaultCredentials="true">
    <proxy autoDetect="True" usesystemdefault="True"/>
</defaultProxy>

我在尝试创建请求时收到“ProtocolException”提示“未找到 openId 端点”。

try 
{
    //ProtocolException is thrown
    IAuthenticationRequest request = openID.CreateRequest(openid_identifier); 
    request.RedirectToProvider();
}
catch (ProtocolException )
{
    throw;
}

Dotnetopenauth 生成的日志文件。 (我已将我的有效用户 ID 替换为 &lt;myopenid&gt;

    {INFO}06/07 17:24:45 - Performing discovery on user-supplied identifier: http://<myopenid>.myopenid.com/
{DEBUG}06/07 17:24:45 - Filtering and sorting of endpoints did not affect the list.
{INFO}06/07 17:30:03 - DotNetOpenAuth, Version=3.4.7.11121, Culture=neutral, PublicKeyToken=2780ccd10d57b246 (official)
{INFO}06/07 17:30:03 - Scanning incoming request for messages: http://localhost/OpenID/User/Authenticate
{DEBUG}06/07 17:30:03 - Incoming HTTP request: POST http://localhost/OpenID/User/Authenticate
{DEBUG}06/07 17:30:31 - .NET Uri class path compression overridden.
{DEBUG}06/07 17:30:31 - HTTP GET http://<myopenid>.myopenid.com/
{ERROR}06/07 17:30:55 - WebException ConnectFailure from http://<myopenid>.myopenid.com/, no response available.
{ERROR}06/07 17:30:55 - Error while performing discovery on: "http://<myopenid>.myopenid.com/": DotNetOpenAuth.Messaging.ProtocolException: Error occurred while sending a direct message or getting the response. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 50.16.193.31:80
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
   --- End of inner exception stack trace ---
   at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
   at DotNetOpenAuth.Messaging.UntrustedWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
   at DotNetOpenAuth.Yadis.Yadis.Request(IDirectWebRequestHandler requestHandler, Uri uri, Boolean requireSsl, String[] acceptTypes)
   at DotNetOpenAuth.Yadis.Yadis.Discover(IDirectWebRequestHandler requestHandler, UriIdentifier uri, Boolean requireSsl)
   at DotNetOpenAuth.OpenId.UriDiscoveryService.Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, Boolean& abortDiscoveryChain)
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.Discover(Identifier identifier)
   at DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm, Uri returnToUrl, Boolean createNewAssociationsAsNeeded)

然后我检查了提琴手,我发现没有生成获取 URI 的请求。似乎 dotnetopenauth 无法生成请求并且在那里失败。

有人可以帮我吗?有什么我遗漏的吗?

我在代理后面工作。

【问题讨论】:

    标签: dotnetopenauth


    【解决方案1】:

    我只能建议您编写一个简单的 C# 控制台应用程序,该应用程序使用 HttpWebRequest 从您输入到 DotNetOpenAuth 的 OpenID URL 下载页面,这样您就可以自己查看故障,并诊断您的问题所在防火墙/代理设置。

    【讨论】:

    • 绝对是一件好事...不幸的是又发现了另一个问题:)
    【解决方案2】:

    我遇到了和你一样的问题,如果我删除了代理自动检测,它就可以工作。因此,在 web.config system.net 部分,只有:

    此配置允许我在公司代理服务器后面工作以及使用 Fiddler。

    【讨论】:

      猜你喜欢
      • 2013-05-23
      • 2013-09-23
      • 1970-01-01
      • 1970-01-01
      • 2012-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-14
      相关资源
      最近更新 更多