Here's a quick review of the issues involved:
%1 is not a valid Win32 application.
(note that if you use IE default error reporting it will not actually show this error because the error message is too short - you'll only see the 500 Internal Error Page)
When running IIS 7 you will get a server based exception and if debugging is enable you will get an Internal Server Error with an ExecuteHandlerRequestHandler error message which looks like a security violation.
This indicates that the ISAPI extension is called from a 64 bit server instance. To fix this issue you need to do the following:
The flag is set in the Application Pool Settings Manager with the Advanced Options:
DO CONSOLE WITH "ENABLE64BIT"
to turn it off:
DO CONSOLE WITH "ENABLE64BIT","OFF"
You can also run CONSOLE.EXE from the Windows Command prompt:
CONSOLE.EXE ENABLE64BIT CONSOLE.EXE ENABLE64BIT OFF
Reconfigure ASP.NET for the proper 32 or 64 bit version
In addition you may have to fix ASP.NET if it is installed on the server. ASP.NET 2.0 installs an ISAPI filter and that filter needs to be tied to either the 32 bit .NET runtime or the 64 bit version. If the wrong filter is installed you will get a Service is Unavailable error as the Application Pool crashes basically on any request and shuts down.
To set up ASP.NET for 32 bit:
To set up ASP.NET for 64 bit:
Note that this ASP.NET configuration is REQUIRED even if you don't use ASP.NET, but if it is enabled. To check for this go to:
IIS Service Manager | Web Sites | ISAPI Filters
In the list you should see the ASP.NET ISAPI filter if it's active. If it is there you will need to run the above command line appropriate for this version. Or if you don't use ASP.NET at all you can just remove the filter.
The Handler works with ASP.NET 2.0 on IIS 6 or as a native HttpHandler in IIS 7.0 and it works without any configuration changes both in 32 and 64 bit mode.
For more information please check out Using the Web Connection Managed Handler.
mmc comexp.msc /32
Failing to do so *may* cause problems with security configuration. Specifically if you don't see the option to run the DCOM component on the local machine you need to run the above. It's not always the case but this has caused several of our customers problems. Running the above always fixes these problems on 64 bit machines.