asp.net - Configuring federated passive Relying Party for IIS 7 classic mode error (Failed to Execute URL) -
i have asp.net relying party uses microsoft identity model , wif passive federated identity. web application works fine in iis 7 under .net 4 integrated pipeline application pool. when switch .net 4 classic pipeline application pool, fails , gives me following error. how can fixed?
exception details: system.web.httpexception: failed execute url.
stack trace:
[httpexception (0x80004005): failed execute url.] system.web.hosting.isapiworkerrequestinprocforiis6.beginexecuteurl(string url, string method, string childheaders, boolean sendheaders, boolean adduserindo, intptr token, string name, string authtype, byte[] entity, asynccallback cb, object state) +4040320 system.web.httpresponse.beginexecuteurlforentireresponse(string pathoverride, namevaluecollection requestheaders, asynccallback cb, object state) +590 system.web.defaulthttphandler.beginprocessrequest(httpcontext context, asynccallback callback, object state) +286 system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +405 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +375
edit
this error occurs when browse website without specifying page. example:
1 - http://www.relyingparty3.com causes error
2 - http://www.relyingparty3.com/default.aspx works fine
i found solution in following msdn forum thread. credit goes users "paullem" (explaining reason of failure) , "alex stankiewicz" (for making fixing code available):
http://social.msdn.microsoft.com/forums/en/geneva/thread/43392dc5-e764-4027-8de5-1638a4c17540
so solve issue, created new class following code:
using system; using system.web; using system.security.principal; using system.threading; using microsoft.identitymodel.claims; using microsoft.identitymodel.web; namespace testapp.code { public class iis6sessionauthenticationmodule : sessionauthenticationmodule { protected override void onpostauthenticaterequest(object sender, eventargs e) { if (!(httpcontext.current.user iclaimsprincipal)) { iclaimsprincipal incomingprincipal = claimsprincipal.createfromhttpcontext(httpcontext.current); claimsauthenticationmanager manager = base.serviceconfiguration.claimsauthenticationmanager; if (((manager != null) && (incomingprincipal != null)) && (incomingprincipal.identity != null)) { incomingprincipal = manager.authenticate(httpcontext.current.request.url.absoluteuri, incomingprincipal); } if (incomingprincipal.identity.isauthenticated) { httpcontext.current.user = incomingprincipal; thread.currentprincipal = incomingprincipal; } else { httpcontext.current.user = new genericprincipal(new genericidentity(string.empty), new string[] { }); thread.currentprincipal = httpcontext.current.user; } } else { if (string.isnullorempty(httpcontext.current.user.identity.name)) { httpcontext.current.user = new genericprincipal(new genericidentity(string.empty), new string[] { }); thread.currentprincipal = httpcontext.current.user; } } } } }
i added following entry "httpmodules" of "system.web" in "web.config", after "wsfederationauthenticationmodule" , "sessionauthenticationmodule":
<add name="iis6sessionauthenticationmodule" type="testapp.code.iis6sessionauthenticationmodule, testapp" />
Comments
Post a Comment