DotNetOpenAuth ... CreatRequest在服务器上中断(在我的机器上工作;-)

时间:2013-04-26 13:30:27

标签: asp.net-mvc dotnetopenauth

我已经基于ASP.NET MVC 4 Web应用程序创建了一个站点。我按照AuthConfig.cs中的说明启用了Twitter,Facebook和Google的OpenAuth登录提供程序。

当在IIS Express上从Visual Studio在我的本地计算机上调试站点时,此工作正常。但是,当我将网站复制到另一台计算机时,除了使用开放身份验证的任何内容之外,整个网站都会正常工作。

在这台机器上,我可以使用浏览器访问twitter,facebook和google。

当我尝试使用我的网站登录时,我得到: 对于Google:" 序列不包含任何元素"堆栈跟踪指向

  

[InvalidOperationException:Sequence不包含任何元素]      System.Linq.Enumerable.First(IEnumerable`1 source)+514      DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier,Realm realm,Uri returnToUrl)+106

     

[ProtocolException:找不到OpenID端点。]      DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier,Realm realm,Uri returnToUrl)+303      DotNetOpenAuth.AspNet.Clients.OpenIdClient.RequestAuthentication(HttpContextBase context,Uri returnUrl)+135      DotNetOpenAuth.AspNet.OpenAuthSecurityManager.RequestAuthentication(String returnUrl)+666      D:\ dtaylor \ Documents \ Visual Studio 2012 \ Projects \ NotesBoard \ NotesBoard \ Controllers \ AccountController.cs中的NotesBoard.Controllers.ExternalLoginResult.ExecuteResult(ControllerContext context):369      System.Web.Mvc。<> c_ DisplayClass1a.b _17()+33      System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,ResultExecutingContext preContext,Func 1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func 1 continuation)+613      System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1过滤器,ActionResult actionResult)+263      System.Web.Mvc.Async。<> c_ DisplayClass25.b _22(IAsyncResult asyncResult)+240      System.Web.Mvc。<> c_ DisplayClass1d.b _18(IAsyncResult asyncResult)+28      System.Web.Mvc.Async。<> c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+53      System.Web.Mvc.Async。<> c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc。<> c_ DisplayClass8.b _3(IAsyncResult asyncResult)+42      System.Web.Mvc.Async。<> c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+606      System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)+288

对于Twitter,我得到:&#34; 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应199.16.156.72:443 < /强>&#34;使用以下堆栈跟踪

  

[SocketException(0x274c):连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应199.16.156.72:443]      System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)+273      System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,Socket&amp; socket,IPAddress&amp; address,ConnectSocketState state,IAsyncResult asyncResult,Exception&amp; exception)+584

     

[WebException:无法连接到远程服务器]      System.Net.HttpWebRequest.GetResponse()+8527180      DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest请求,DirectWebRequestOptions选项)+261

     

[ProtocolException:发送直接消息或获取响应时出错。]      DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest请求,DirectWebRequestOptions选项)+1862      DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request)+516      DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage)+138      DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage)+45      DotNetOpenAuth.OAuth.ConsumerBase.PrepareRequestUserAuthorization(Uri callback,IDictionary 2 requestParameters, IDictionary 2 redirectParameters,String&amp; requestToken)+202      DotNetOpenAuth.AspNet.Clients.DotNetOpenAuthWebConsumer.RequestAuthentication(Uri callback)+88      DotNetOpenAuth.AspNet.OpenAuthSecurityManager.RequestAuthentication(String returnUrl)+666      D:\ dtaylor \ Documents \ Visual Studio 2012 \ Projects \ NotesBoard \ NotesBoard \ Controllers \ AccountController.cs中的NotesBoard.Controllers.ExternalLoginResult.ExecuteResult(ControllerContext context):369      System.Web.Mvc。&lt;&gt; c_ DisplayClass1a.b _17()+33      System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,ResultExecutingContext preContext,Func 1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func 1 continuation)+613      System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1过滤器,ActionResult actionResult)+263      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass25.b _22(IAsyncResult asyncResult)+240      System.Web.Mvc。&lt;&gt; c_ DisplayClass1d.b _18(IAsyncResult asyncResult)+28      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+53      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc。&lt;&gt; c_ DisplayClass8.b _3(IAsyncResult asyncResult)+42      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+606      System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+288

另一方面,Facebook实际上提示我输入用户名和密码,但随后又返回&#34; 连接尝试失败,因为连接方在一段时间后没有正确响应,或已建立连接失败,因为连接的主机无法响应173.252.100.27:443"和以下堆栈跟踪:

  

[SocketException(0x274c):连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应173.252.100.27:443]      System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)+273      System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,Socket&amp; socket,IPAddress&amp; address,ConnectSocketState state,IAsyncResult asyncResult,Exception&amp; exception)+584

     

[WebException:无法连接到远程服务器]      System.Net.WebClient.DownloadDataInternal(Uri地址,WebRequest&amp; request)+3624556      System.Net.WebClient.DownloadString(Uri地址)+213      DotNetOpenAuth.AspNet.Clients.FacebookClient.QueryAccessToken(Uri returnUrl,String authorizationCode)+399      DotNetOpenAuth.AspNet.Clients.OAuth2Client.VerifyAuthentication(HttpContextBase context,Uri returnPageUrl)+186      DotNetOpenAuth.AspNet.OpenAuthSecurityManager.VerifyAuthentication(String returnUrl)+502      Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.VerifyAuthenticationCore(HttpContextBase context,String returnUrl)+250      D:\ dtaylor \ Documents \ Visual Studio 2012 \ Projects \ NotesBoard \ NotesBoard \ Controllers \ AccountController.cs中的NotesBoard.Controllers.AccountController.ExternalLoginCallback(String returnUrl):225      lambda_method(Closure,ControllerBase,Object [])+127      System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary 2 parameters) +274 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary 2个参数)+39      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass39.b _33()+120      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4f.b _49()+ 452      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4f.b _49()+ 452      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass37.b _36(IAsyncResult asyncResult)+15      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass2a.b _20()+33      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass25.b _22(IAsyncResult asyncResult)+240      System.Web.Mvc。&lt;&gt; c_ DisplayClass1d.b _18(IAsyncResult asyncResult)+28      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+53      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.Mvc。&lt;&gt; c_ DisplayClass8.b _3(IAsyncResult asyncResult)+42      System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass4.b _3(IAsyncResult ar)+15      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+606      System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+288

PS。值得一提的是,我们通过代理访问互联网,该代理在IE中的服务器上设置。我还没有在提供的模板中找到任何代码,让我指定代理服务器等。

请帮助。

1 个答案:

答案 0 :(得分:2)

我想我能够解决这个问题。事实证明,我们的代理服务器似乎一直是个问题。我在IIS中运行此站点的应用程序池配置为使用NetworkServices作为应用程序池标识。我改变了身份以自己运行,看看问题是否已经解决了。显然不建议将网站作为用户帐户运行,因此我将要求我们的IT团队为该网站创建一个域帐户,该帐户也可以通过我们的代理服务器进行访问。

我希望能帮助其他人解决同样的问题。