asp.net mvc - Google OpenID provider consistently fails on Azure -


i'm trying use google openid mvc 4 app hosted on azure & keeps failing. not straight away though. when deploy app, works time after time. leave amount of time, day, hour & try again & fails everytime. refresh, go homepage, sends login page & works again.

the error :

[invalidoperationexception: sequence contains no elements]    system.linq.enumerable.first(ienumerable`1 source) +498    dotnetopenauth.openid.relyingparty.openidrelyingparty.createrequest(identifier usersuppliedidentifier, realm realm, uri returntourl) +106  [protocolexception: no openid endpoint found.]    dotnetopenauth.openid.relyingparty.openidrelyingparty.createrequest(identifier usersuppliedidentifier, realm realm, uri returntourl) +303    tools.helpers.googleapps.login(uri returnurl) in c:\users\simon\documents\visual studio 2012\projects\internal utils\website\helpers\googleapps.cs:33    tools.helpers.externalloginresult.executeresult(controllercontext context) in c:\users\simon\documents\visual studio 2012\projects\internal utils\website\helpers\externalloginresult.cs:25    system.web.mvc.<>c__displayclass1a.<invokeactionresultwithfilters>b__17() +33    system.web.mvc.controlleractioninvoker.invokeactionresultfilter(iresultfilter filter, resultexecutingcontext precontext, func`1 continuation) +613    system.web.mvc.controlleractioninvoker.invokeactionresultwithfilters(controllercontext controllercontext, ilist`1 filters, actionresult actionresult) +263    system.web.mvc.async.<>c__displayclass25.<begininvokeaction>b__22(iasyncresult asyncresult) +230    system.web.mvc.<>c__displayclass1d.<beginexecutecore>b__18(iasyncresult asyncresult) +28    system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +20    system.web.mvc.controller.endexecutecore(iasyncresult asyncresult) +53    system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +20    system.web.mvc.<>c__displayclass8.<beginprocessrequest>b__3(iasyncresult asyncresult) +42    system.web.mvc.async.<>c__displayclass4.<makevoiddelegate>b__3(iasyncresult ar) +20    system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +469    system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +375 

my code triggers request is:

    //constructor     static googleapps()     {         var googleappdiscovery = new hostmetadiscoveryservice         {             usegooglehostedhostmeta = true,         };          relyingparty = new openidrelyingparty();         relyingparty.discoveryservices.insert(0, googleappdiscovery);     }      public void login(uri returnurl)     {         var realm = new realm(returnurl.getcomponents(uricomponents.schemeandserver, uriformat.unescaped));          var request = relyingparty.createrequest("my.domain.name", realm, returnurl);          var fetch = new fetchrequest();         fetch.attributes.add(new attributerequest(wellknownattributes.contact.email, true));         fetch.attributes.add(new attributerequest(wellknownattributes.name.first, true));         fetch.attributes.add(new attributerequest(wellknownattributes.name.last, true));         request.addextension(fetch);          request.redirecttoprovider();     } 

i have not added web.config, other proxy config settings recommended elsewhere. doesn't seem make difference.

<defaultproxy enabled="true">   <proxy autodetect="true" usesystemdefault="true" /> </defaultproxy> 

i'm using latest 4.2.2 packages nuget.

so looks increasing timeouts made work, suggested here. set values higher suggested, can test appropriate values.

i changed code. you'll notice above class contains static variable replying party. changed instance variable see no reason use pattern. sample code dotnetopenauth doesn't use static instances replying party class either.

unless can suggest why having static might idea, i'll leave is.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -