2011-06-07 40 views
3

我想實現OpeinID登錄與ASP.NET MVC。我試圖按照http://blog.nerdbank.net/2008/04/add-openid-login-support-to-your-aspnet.htmlDotnetopenAuth拋出一個「的ProtocolException

下面是我設置的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 end point'。

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

由Dotnetopenauth生成的日誌文件。 (我已經取代我的有效的用戶ID與<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無法生成請求,並在那裏失敗。

任何人都可以幫我在這裏嗎?任何我缺少的東西?

我正在代理之後工作。

回答

1

我所能建議的只是編寫一個簡單的C#控制檯應用程序,它使用HttpWebRequest從您輸入到DotNetOpenAuth的OpenID URL下載頁面,以便您自己查看失敗並診斷防火牆出了什麼問題/代理設置。

+0

絕對是一件好事......不幸的是透露了另一個問題:) – Matthias 2013-11-19 15:35:30

0

我和你有同樣的問題,如果我刪除代理自動檢測,它工作。因此,在web.config中system.net部分,只有:

這種配置讓我從背後企業代理服務器以及與使用招工作。

相關問題