Sequence contains no elements. No OpenID endpoint found

1,963 views
Skip to first unread message

Aly Boghani

unread,
Feb 1, 2014, 12:09:24 PM2/1/14
to

This code works perfect fine on local machine but on my staging servers I am getting this issue every now and then. And after few min, it will just go away.
I even increased time out in web.config
<messaging clockSkew="00:10:00" lifetime="00:03:00" strict="true">      <untrustedWebRequest timeout="00:10:30" readWriteTimeout="00:10:30.500"> <whitelistHosts> <!-- Uncomment to enable communication with localhost (should generally not activate in production!) --> <!--<add name="localhost" />--> </whitelistHosts></untrustedWebRequest>    </messaging>
LOG4NET Logs2014-02-01 10:33:18,038 (GMT-6) [14] DEBUG DotNetOpenAuth.Messaging.Channel - Preparing to send AccessTokenRefreshRequest (2.0) message.2014-02-01 10:33:18,038 (GMT-6) [14] INFO  DotNetOpenAuth.Messaging.Channel - Prepared outgoing AccessTokenRefreshRequest (2.0) message for https://accounts.google.com/o/oauth2/token refresh_token: 1/mUT-p67CE1hkns--37Mt-h1N1zZTEecA7zD9xvFGggk grant_type: refresh_token client_id: 544360995449-cpomd50e98cajqf8j6hacobk8t4unq46.apps.googleusercontent.com client_secret: ra9k15dIs-tVDdZqYK6pCnxo
2014-02-01 10:33:18,038 (GMT-6) [14] DEBUG DotNetOpenAuth.Messaging.Channel - Sending AccessTokenRefreshRequest request.2014-02-01 10:33:18,646 (GMT-6) [14] DEBUG DotNetOpenAuth.Http - HTTP POST https://accounts.google.com/o/oauth2/token2014-02-01 10:33:18,740 (GMT-6) [14] DEBUG DotNetOpenAuth.Messaging - The following required parameters were missing from the DotNetOpenAuth.OAuth2.Messages.AccessTokenFailedResponse message: {error,}2014-02-01 10:33:18,740 (GMT-6) [14] WARN  DotNetOpenAuth.Messaging - Multiple message types seemed to fit the incoming data: {AccessTokenSuccessResponse (2.0),UnauthorizedResponse (2.0),}


System.InvalidOperationExceptionSequence contains no elements

DotNetOpenAuth.Messaging.ProtocolException: No OpenID endpoint found. ---> System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl)
   --- End of inner exception stack trace ---
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl)
   at DotNetOpenAuth.AspNet.Clients.OpenIdClient.RequestAuthentication(HttpContextBase context, Uri returnUrl)
   at DotNetOpenAuth.AspNet.OpenAuthSecurityManager.RequestAuthentication(String returnUrl)
   at UI.Controllers.HomeController.LoginGoogle(RegisterUser model)
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Aly Boghani

unread,
Feb 1, 2014, 1:59:24 PM2/1/14
to dotnet...@googlegroups.com
Detailed Log
2014-02-01 12:55:37,581 (GMT-6) [7] DEBUG DotNetOpenAuth.Yadis - Skipping HTML discovery because XRDS contained service endpoints.
2014-02-01 12:55:37,581 (GMT-6) [7] INFO  DotNetOpenAuth.OpenId - Received identity assertion for https://www.google.com/accounts/o8/id?id=AItOawk0grJsunWDHQxx7NT3NZN8Yks9JVmXTCQ via https://www.google.com/accounts/o8/ud.
2014-02-01 12:55:44,742 (GMT-6) [14] DEBUG DotNetOpenAuth.Http - HTTP GET https://www.google.com/accounts/o8/id
2014-02-01 12:55:45,023 (GMT-6) [14] ERROR DotNetOpenAuth.Http - SendFailure connecting to https://www.google.com/accounts/o8/id
2014-02-01 12:55:45,023 (GMT-6) [14] ERROR DotNetOpenAuth.Yadis - Error while performing discovery on: "https://www.google.com/accounts/o8/id": DotNetOpenAuth.Messaging.ProtocolException: Error occurred while sending a direct message or getting the response. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.ConnectStream.WriteHeaders(Boolean async)
   --- 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.IdentifierDiscoveryServices.Discover(Identifier identifier)
   at DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm, Uri returnToUrl, Boolean createNewAssociationsAsNeeded)
2014-02-01 12:55:45,023 (GMT-6) [14] INFO  DotNetOpenAuth.Yadis - Performing discovery on user-supplied identifier: https://www.google.com/accounts/o8/id
2014-02-01 12:55:45,023 (GMT-6) [14] DEBUG DotNetOpenAuth.Yadis - Filtering and sorting of endpoints did not affect the list.

Steven Kuhn

unread,
Mar 14, 2014, 5:53:55 PM3/14/14
to dotnet...@googlegroups.com
I've been having the exact same problem for the past 2-3 months now. It was fine for the over the last year but it just starting throwing these errors sporadically in 3 different environments (Test, UAT, Production). I've changed timeout values. I have switched from using the HostMetaDiscoveryService (UseGoogleHostedHostMeta = true) with my employers domain to simply using "https://www.google.com/accounts/o8/id". I've also tried changing the defaultProxy settings in my web.config. None of that has worked. It has been frustrating because it'll work fine for a few hours and then seemingly start throwing the same exception. And it won't occur in the different environments at the same time.

The error message from log4net is below:

Error while performing discovery on: "https://www.google.com/accounts/o8/id": DotNetOpenAuth.Messaging.ProtocolException: Error occurred while sending a direct message or getting the response. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Aly Boghani, do you by chance have your code running in an Azure Web Role or in Azure at all? I'm running my application in an Azure Cloud Service (a single web role, running on 2 instances). My current hypothesis is that it is a communication issue between Azure and Google. Prior to yesterday, the cloud service shared the same affinity group with a virtual network my employer has running. Then yesterday I've recreated the cloud service for all my environments, but chose "North Central US" instead of in the affinity group. I haven't seen the issue since then, but I'm going to give it a week or two to see if the issue has truly disappeared.

Hope this helps anyone who comes across the same issue.

Thanks,
Steven

Chuck Rice

unread,
Mar 21, 2014, 3:31:07 PM3/21/14
to dotnet...@googlegroups.com
I have been having a similar issue with our environments that are deployed in Azure cloud. I have attempted modifying the timeout values to no avail. I did notice that some days this error seems to appear more often than others. I am unsure yet if this correlates to days when we push up a new build to our environments or not.

Steven Kuhn, did you have any success with changing your affinity group?

here are the logs from log4net
HTTP GET https://www.google.com/accounts/o8/id

Error in openid popup request authentication, DotNetOpenAuth.Messaging.ProtocolException: No OpenID endpoint found. ---> System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl)
--- End of inner exception stack trace ---
at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl)
at Website.Controllers.OpenIdController.GetProviderRequest(OpenIdProvider provider, String platform, Boolean isNewAccount) in c:\src-r\Website\Controllers\OpenIdController.cs:line 152
at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.Discover(Identifier identifier)
at DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm, Uri returnToUrl, Boolean createNewAssociationsAsNeeded)

Aly Boghani

unread,
Mar 21, 2014, 4:59:28 PM3/21/14
to dotnet...@googlegroups.com
I downgraded my amazon instance to windows 2008 instead of windows 2012 and it started working fine. 


--
DotNetOpenAuth Related Links
» Wiki: http://goo.gl/cO58dm
» Code Samples: http://goo.gl/yPeJf4
» Stack Overflow: http://goo.gl/HxvUzV
---
You received this message because you are subscribed to a topic in the Google Groups "DotNetOpenAuth" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotnetopenid/SWw10f8MI_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotnetopenid...@googlegroups.com.
To post to this group, send email to dotnet...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotnetopenid/00d78498-447e-4260-975c-faf82078a7ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Kuhn

unread,
Mar 21, 2014, 5:24:21 PM3/21/14
to dotnet...@googlegroups.com
Chuck Rice: After recreating the Cloud Service inside the US North Central region instead of using the custom affinity group that my employer has for the same region, I haven't had a problem since. The next thing I want to try is to create a new affinity group just for my application and move the storage account and Azure SQL database to that same one. I'm not sure when I'll get to that, but at least it seems to be working now.

Chuck Rice

unread,
Mar 24, 2014, 10:25:15 AM3/24/14
to dotnet...@googlegroups.com
Well I can say for a certainty that the Affinity group solution will not solve my situation then as our environments are already part of the North Central AG.
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& <span style=
...

Chuck Rice

unread,
Apr 18, 2014, 4:15:31 PM4/18/14
to dotnet...@googlegroups.com
For anyone interested, I migrated our Google OpenId Logins to Google OpenId Connect (OAuth2). thus far we have not had any issues with the endpoints.
Reply all
Reply to author
Forward
0 new messages