DotnetopenAuth引发" ProtocolException [英] DotnetopenAuth throws a "ProtocolException

查看:101
本文介绍了DotnetopenAuth引发" ProtocolException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to implement OpeinID login with ASP.NET MVC. I am trying to follow steps given as in http://blog.nerdbank.net/2008/04/add-openid-login-support-to-your-aspnet.html

下面是我的设置web.config

Below is my settings 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端点。

I get the 'ProtocolException' saying 'No openId end point found' when I try to create a request.

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

Dotnetopenauth生成的日志文件。 (我已经用< myopenid> 替换了我的有效用户ID)

Log File generated by Dotnetopenauth. (I have replaced my valid userid with <myopenid> )

    {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无法生成请求,并且在那里失败。

I then checked with fiddler and I see no request getting generated to get the URI. It seems that dotnetopenauth is not able to generate the request and is failing there.

有人可以在这里帮助我吗?我缺少什么吗?

Can anybody please help me out here? Anything that I am missing?

我正在从代理后面工作。

I am working from behind a proxy.

推荐答案

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

All I can suggest is that you write a trivial C# console app that uses HttpWebRequest to download the page from your OpenID URL that you're typing into DotNetOpenAuth so you can see the failure yourself, and diagnose what's wrong with your firewall/proxy settings.

这篇关于DotnetopenAuth引发&quot; ProtocolException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆