OpenId Single Sign In Problem

Dec 2, 2011 at 2:31 PM


I am trying to get single sign on to work with my main site by setting up an Open ID provider. I am getting the error below when I click the "sign in with your site credentials" button. I have the following setup:

1. Forums site. Currently running as http://localhost:58806. Will eventually be

2. Main site. Currently running as http://localhost:65351. Will eventually just be

3. My main site has a custom membership provider setup and registered as default.

4. I have installed OpenId provider in the OpenIdProviderMvc project of DotNetOpenAuth onto my main site. 

5. On the forums site, I have this in my Site.config file: 

<authorizationProviders fakeProvider="false"> <ssoOpenid identifier="http://localhost:65351/OpenId/Provider" /> <formsAuth defined="true" /> </authorizationProviders>

Any ideas? Did I miss a step? My main site never seems to get a request. 



Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +336
   DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl) +93

[ProtocolException: No OpenID endpoint found.]
   DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl) +171
   NearForums.Web.Controllers.AuthenticationController.OpenIdStartLogin(String openidIdentifier, String returnUrl) +424
   lambda_method(Closure , ControllerBase , Object[] ) +157
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184



Dec 2, 2011 at 6:15 PM

Hi Jason,

I don't have much experience with OpenId. I can think of some test you could do to see whats going wrong:

  • Use a OpenId identifier of a public OpenId provider, for example: <ssoOpenid identifier="" />. Check if it works.
  • In another Visual Studio instance, open the DotNetOpenAuth sample solution (provided in the downloadable) and run them. Use the url of the web project OpenIdWebRingSsoProvider as identifier.

Note that the identifier should not be the address of the "log in form", it should be the url were the service is "described" (if requested using application/xrds+xml content type).

If after doing this tests you are still stuck'd, you should ask the DotNetOpenAuth team for help (A. Arnott) or check stackoverflow for similar issues, like this one:


Kind Regards,


Dec 2, 2011 at 7:00 PM

Hi Jorge,

Thanks for the reply. You were right - using a public provider works just fine. Something is wrong with my site's provider. I'll debug that.



Jan 31, 2012 at 7:39 PM

Hi, I have the same problem...

have you solved

I'm really losing hours and hours, if you have any advice I would be grateful!

Thank you!

Feb 2, 2012 at 10:46 AM

Did you tried using the Dotnetopenauth sample (OpenIdWebRingSsoProvider)?

Feb 2, 2012 at 11:16 AM
jorgebg wrote:

Did you tried using the Dotnetopenauth sample (OpenIdWebRingSsoProvider)?

I solved thanks!

Localhost was locked by default, just add to the white list..

Feb 2, 2012 at 11:58 AM

Happy to hear!

Jan 27, 2014 at 4:45 PM
Edited Jan 27, 2014 at 4:46 PM

I'm encountering the same problem. I'm using the DotnetOpenAuth Provider with other sites locally it works like a charm. But with near forums it gives the same error.
I have added it to the whitelist as well. I'm really pressed for time, any help would be greatly appreciated.