IIS 7 and Above
Failed to Execute Url (System.Web.DefaultHttpHandler.BeginProcessRequ...
Last post Jun 11, 2008 12:10 PM by tmarq
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);
Failed to Execute URL.
h:\yf\App_Code \Handlers\CustomDefaultHandler.csline 101
Oct 27, 2007 02:36 AM|mvolo|LINK
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:
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.
IIS Core Server
Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET
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?
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?
Oct 28, 2007 07:39 AM|nathanaeljones|LINK
Always happens, and only on my Vista machine.
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.
IIS Core Server
Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET
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?
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.
Nov 01, 2007 05:57 AM|nathanaeljones|LINK
How does a 4KB repro sound?
Let me know what you find... My Vista development is kinda crippled until I get this resolved.
Thank you very much,
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.
Nov 03, 2007 12:13 PM|nathanaeljones|LINK
I appreciate it.
Nov 05, 2007 11:54 AM|nathanaeljones|LINK
Any news yet? Did you have any trouble reproducing the issue with the sample project?
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.
Nov 08, 2007 11:20 PM|mvolo|LINK
The developer is looking at it now, I'll post when I hear.
Nov 14, 2007 11:19 AM|nathanaeljones|LINK
Nov 19, 2007 06:40 PM|tmarq|LINK
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:
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.
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).
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.
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:
<add name="ASPNET" path="*" verb="*" modules="IsapiModule"
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?
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?
Thank you very, very much!
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.