Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to Execute URL - any ideas?

I am seeing some entries of the following exception in my logs and dont know why or where its occurring:

Failed to Execute URL.
   at 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)
   at System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state)
   at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Has anyone come across this before or could shed some light on it? I running a .net 3.5 c# web application on IIS7.

like image 642
amateur Avatar asked Apr 13 '11 17:04

amateur


2 Answers

I just ran into this while using Windows Identity Foundation. The problem ended up being resolved by switching the application pool to use Integrated instead of Classic. It was failing when there was a trailing slash on the url and redirecting to the login page. Specifying the full page in the url didn't give the error.

like image 97
David Scott Avatar answered Nov 15 '22 21:11

David Scott


I had the same error when using WIF in classic pipeline mode. Because we unfortunately cannot change the application to integrated pipeline mode, I've implemented a fix for the specific scenario that David Scott describes.

In global.asax.cs:

    protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {        
      // Fix for "Failed to Execute URL" when non-authenticated user 
      // browses to application root 
      if ((User == null) 
        && (string.Compare(Request.Url.AbsolutePath.TrimEnd('/'), 
        Request.ApplicationPath, true) == 0))
      {
        Response.Redirect(Request.ApplicationPath + "/Default.aspx");
        HttpContext.Current.ApplicationInstance.CompleteRequest();
      }
    }

Before the authentication attempt, Application_AuthenticateRequest is called with a null User object. Only in that case, the code redirects from / to /Default.aspx (my app is Asp.Net web forms). This fixed the problem for us.

like image 1
Berend Engelbrecht Avatar answered Nov 15 '22 22:11

Berend Engelbrecht