Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7 [Answered]RSS

20 replies

Last post Jun 11, 2008 12:10 PM by tmarq

  • Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 26, 2007 11:15 AM|nathanaeljones|LINK

    I have a asp.net application that I deploy to a WS2003 server. It is built for the classic pipeline mode.

    However, my home development machine runs Vista, and I am trying to get it working there also. 
     

    I have a CustomDefaultHandler registered instead of DefaultHttpHandler, from which it is derived.

    CustomDefaultHandler watches for ?download=true in the query string, and appends the content-disposition:attachement header before passing the request on to the base class with the statement return base.BeginProcessRequest(context, callback, state);

    I have a script map for * to aspnet_isapi.dll. Default documents are disabled. To eliminate any NTFS ACL issues, I gave the Everyone group Full Control over the entire web site folder (no, this isn't permanent).

     Anonymous, Forms, and Windows authenticate are enabled (anonymous runs under Network Service), and Forms is database-driven. Windows is on for VS2005 debugging support.

     And, of course, the application is running in the ASP.NET 2.0 classic pool as NETWORK SERVICE.

    I receive this error from any requests that go through return base.BeginProcessRequest(context, callback, state);

    <div class="exceptionViewer">

    System.Web.HttpException

    Failed to 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)
    • System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state)
    • System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
    • fbs.Handlers.CustomDefaultHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback , Object state)

      h:\yf\App_Code \Handlers\CustomDefaultHandler.csline 101

    • System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute ()
    • System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    </div><div class="exceptionViewer"> </div><div class="exceptionViewer"> I've been fighting this forever - it's time to call in the experts. </div>
  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 27, 2007 02:36 AM|mvolo|LINK

    Hi Nathan,

    Unfortunately, DefaultHttpHandler (and derivations) is not supported in Integrated mode.  Breaking changes are documented here: http://www.iis.net/articles/view.aspx/IIS7/Hosting-Web-Applications/ASP-NET/Upgrading-ASP-NET-1-1-to-IIS7-on-Windows-Vista---L?Page=3

    If your application is designed for IIS6.0, you can always configure it to run on IIS7 by placing it in Classic mode (change the apppool mode) - more details here: http://www.iis.net/default.aspx?i=928&subtabid=25&tabid=2&p=2.

    If you can develop a separate version of your application for IIS7, you can move the logic from your DefaultHttpHandler to an ASP.NET module that runs for all requests.  In essense, DefaultHttpHandler in IIS6.0 is a very limited way to emulate an integrated pipeline (running ASP.NET modules for all requests), which is obsoleted in IIS7 with the real integrated pipeline.

    Your ASP.NET module in IIS7 integrated mode will run for all requests.  It can also change request headers using the HttpRequest.Headers collection which is now writable, and redirect to different urls using RewritePath.  One of the key benefits of this is performance, because it eliminates the need to wildcard-map ASP.NET ISAPI and execute child requests.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 27, 2007 08:10 AM|nathanaeljones|LINK

    Thanks for the reply. I look forward to embracing IIS7 and its architecture, but I can't break compatibility with IIS6 quite yet... IIS7 just happens to be on my development box.

    I am currently using the ASP.NET 2.0 Classic Pipeline app pool. Shouldn't the DefaultHttpHandler be working, then?

     
    Thanks,

    Nathanael
     

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 27, 2007 09:58 PM|mvolo|LINK

    It should be ... does this failure happen only on IIS7? Does it happen always or only in certain cases?

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 28, 2007 07:39 AM|nathanaeljones|LINK

     Always happens, and only on my Vista machine.

     

    Thanks,

    Nathanael 

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 28, 2007 06:59 PM|mvolo|LINK

    Can you provide a self-contained repro ZIP that contains the code and application necessary to reproduce the problem?  Then we can take a look further.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 29, 2007 07:32 PM|nathanaeljones|LINK

    The entire app is > 4GB. I'll need to trim it down first.

     Do you have an upload location I can use, or should I host the .zip file on one of my servers?

     

    Thanks,

    Nathanael

     

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Oct 29, 2007 11:45 PM|mvolo|LINK

    We would need a very simplified repro (if you can, just a single class that implements DefaultHttpHandler).  Otherwise we are not able to investigate it on the product team, and you would have to go through the normal support channels.

    If you can host it on your server and give us a url to download it, that would be great.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 01, 2007 05:57 AM|nathanaeljones|LINK

    How does a 4KB repro sound?

    http://youngfoundations.org/iistest.zip  

     

    Let me know what you find... My Vista development is kinda crippled until I get this resolved.

    Thank you very much,

    Nathanael Jones
     

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 01, 2007 09:54 PM|mvolo|LINK

    I've asked one of our devs to take a look.  Will let you know once I hear back.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 03, 2007 12:13 PM|nathanaeljones|LINK

    I appreciate it. 

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 05, 2007 11:54 AM|nathanaeljones|LINK

    Any news yet? Did you have any trouble reproducing the issue with the sample project? 

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 06, 2007 04:55 PM|nathanaeljones|LINK

    Did you have any trouble reproducing the issue? It should have just been an unzip and creating the IIS site.

    Attach with VS2005, and the error will be caught on the first page request. 

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 08, 2007 11:20 PM|mvolo|LINK

    Hi Nathan,

    The developer is looking at it now, I'll post when I hear.

    Thanks,

    Mike

    Mike Volodarsky
    CTO at LeanSentry
    Former IIS/ASP.NET PM

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 14, 2007 11:19 AM|nathanaeljones|LINK

    Any news?

  • tmarq tmarq

    48 Posts

    Microsoft

    Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 19, 2007 06:40 PM|tmarq|LINK

    Hi Nathan,

    I'm sorry you did not receive a response sooner.  In classic mode on IIS 7.0, the DefaultHttpHandler works exactly the same way it does on IIS 6.0.  Keep the following in mind:

    • <div mce_keep="true">The handler mappings listed in the httpHandlers section of a particular web.config file override those in a web.config file at a higher level.  For example, if you have *.aspx mapped in the root web.config and you have * mapped in the application's local web.config, then the handler specified by * wins.</div>
    • <div mce_keep="true">Within a single web.config file, the story is different.  Within a single file, the first handler mapping that matches wins.  For example, if *.aspx appears twice, the first one wins.  Or as another example, if * is followed by *.aspx, then * wins.</div>
    • <div mce_keep="true">If you want to use DefaultHttpHandler for non-asp.net extensions, you need to have a * wildcard mapping to aspnet_isapi.dll.  When you make a request to a resource IIS will invoke aspnet_isapi.dll and the DefaultHttpHandler will call the IIS server support function (SSF) HSE_REQ_EXEC_UNICODE_URL with the HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR flag.  This will cause IIS to invoke the real handler (not the * wildcard mapped handler).  </div>

    Your simple repro will not serve ASPX pages because you have cleared all handlers except for your CustomDefaultHandler, which simply invokes DefaultHttpHandler.  The DefaultHttpHandler cannot serve ASPX pages...it never could.  You need to add the PageHandlerFactory mapping for *.aspx to your the httpHandlers section and it needs to come before the * mapping for your CustomDefaultHandler.

    Thanks,
    Thomas

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 20, 2007 02:41 PM|nathanaeljones|LINK

    On the complete web site I am trying to serve .jpg files, not .aspx files, and I recieve the same error. I believe I may have over-simplified the problem here.

     Please try adding an image to the .aspx page, and adding the PageHandlerFactory back in as you mentioned. You will still receive the "Failed to Execute Url" error for the image request. (Try browsing to the image directly).
     

     



     


     

     

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 20, 2007 02:43 PM|nathanaeljones|LINK

    I forgot to add: I do have * mapped to aspnet_isapi.dll, and I understand how handlers are matched and executed. This is just a case of DefaultHttpHandler refusing to serve a .jpg file in Classic mode.

     

    Also, the "Email Subscription" feature on this forum doesn't work for me. You may want to pass that on to the dev team. 

     

     

  • tmarq tmarq

    48 Posts

    Microsoft

    Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Nov 20, 2007 06:27 PM|tmarq|LINK

    I'm not able to reproduce the problem that you're observing.  I created an IIS application on Windows Server 2008 RC0 with the following web.config file in my application's root folder:

    <configuration>
      <system.webServer>
        <handlers>
          <add name="ASPNET" path="*" verb="*" modules="IsapiModule"
                  scriptProcessor="D:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
                  resourceType="Unspecified" requireAccess="None"
                  preCondition="classicMode,runtimeVersionv2.0,bitness32" />
        </handlers>
      </system.webServer>
    </configuration>

    Note that my web.config file adds the wildcard * mapping so all requests are sent to aspnet_isapi.dll.  When I request a JPG file, it is served by ASP.NET, which I confirmed by setting a break point on System.Web.DefaultHttpHandler.BeginProcessRequest. 

    Also, after modifying the files in the test you posted at http://youngfoundations.org/iistest.zip to include the wildcard * mapping to aspnet_isapi.dll, I am able to serve JPG files with your test too.

    I'm not sure what you are doing differently.  Perhaps you could do the following:

    1. Create a new application and make sure that you are using the default <handlers> as they appear in the applicationHost.config file.  In other words, make sure the <handlers> are not modified by root web.config file at %WINDIR%\Microsoft.NET\Framework%ARCH%\v2.0.50727\config, the web.config at \inetput\wwwroot, or in the web.config file of any (parent) applications that contain your applicaiton.

    2. Make sure the application is configured for classic mode.

    3. Now, in this new and clean application, create a wildcard * mapping to aspnet_isapi.dll.  You can do this via IIS Manager.  After you do this, you should see a new web.config file in the root folder of your application with a <handlers> section that contains the wildcard * mapping to aspnet_isapi.dll, and nothing else.

    4. Now if you request a JPG file, it should be served by ASP.NET.  You could use a break point to confirm this.

    After following these 4 steps, does System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl still throw an HttpException with the message "Failed to Execute URL"?  Or is this working now?

    Thanks,
    Thomas

  • Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Jun 11, 2008 07:41 AM|nathanaeljones|LINK

    Sorry for the very late reply... I did get it working with the web.config snippet. My Vista development kind of got delayed for a while, and I was working on my XP box meanwhile.

     

    Inserting this manually worked - I'm not sure why adding the wildcard mapping from the management console didn't work - shouldn't it have automatically added this? 

    <configuration>
      <system.webServer>
        <handlers>
          <add name="ASPNET" path="*" verb="*" modules="IsapiModule"
                  scriptProcessor="D:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
                  resourceType="Unspecified" requireAccess="None"
                  preCondition="classicMode,runtimeVersionv2.0,bitness32" />
        </handlers>
      </system.webServer>
    </configuration>

     

    Thank you very, very much!

  • tmarq tmarq

    48 Posts

    Microsoft

    Re: Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequest) on IIS7

    Jun 11, 2008 12:10 PM|tmarq|LINK

    I added the wildcard mapping via the management console, but when I posted to the forum I simply copied the web.config file for the application.  The management console wrote the changes to my web.config file.

    Thanks,
    Thomas