Freigeben über


HOWTO: Diagnose one cause of W3SVC failing to start with Win32 Error 193 on 64bit Windows

I recently came across an interesting new variation of "failure" related to enabling WOW64 that can happen on IIS6 on 64bit Windows... so I am going to explain what happened and how to fix it.

Question:

Hi,

I ran into an issue with IIS in wow64 mode. On this machine I consistently get an error trying to turn on wow64 mode.

I turn on wow64 mode in IIS, do IISReset, and then when I run “aspnet_regiis –I –enable” from the 32-bit directory, I get an error in the log file:

2005-12-14 12:37:39 Failure Waiting for service to start: WaitForServiceState failed with HRESULT 8007041d: 'The service did not respond to the start or control request in a timely fashion. '
2005-12-14 12:37:40 Failure Starting service: w3svc: StartServiceByName failed with HRESULT 8007041d: 'The service did not respond to the start or control request in a timely fashion. '
2005-12-14 12:37:40 Failure Restarting W3SVC: RestartW3svc failed with HRESULT 8007041d: 'The service did not respond to the start or control request in a timely fashion. '

If I check the w3svc service, it is stopped. If I try to start it, I get:

The World Wide Web Publishing Service service is starting.
The World Wide Web Publishing Service service could not be started.

A system error has occurred.

System error 193 has occurred.

*** is not a valid Win32 application.

If I check the EventVwr, I get:

Could not load all ISAPI filters for site/service. Therefore startup aborted.

ISAPI Filter 'd:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see https://go.microsoft.com/fwlink/?LinkId=29349.

This error makes no sense to me, because at this point IIS is in wow64 mode, so it should not have any problems loading the 32-bit aspnet_filter.dll.

I double-checked that wow64 mode is turned on:

 Enable32BitAppOnWin64           : (BOOLEAN) True

Do you know what could be causing this?

Answer:

Hmm... this issue is indeed interesting because all the rules for running IIS6 in WOW64 mode, as explained in this blog entry, were obeyed... except for one little detail that I did not mention earlier, though it is definitely there in MSDN documentation:

WOW64 mode is only valid when IIS6 is running in Worker Process Isolation Mode.

In particular, WOW64 mode is not valid when IIS6 is running in IIS5 Compatibility Mode. Now, we can argue over the philosophical oxymoron where "IIS5 never existed as 64bit" and "IIS6's IIS5 Compatibility Mode on 64bit Windows only runs as 64bit", but let's not sidetrack ourselves here... ;-)

The Problem...

What happened in this situation is that IIS6 is simultaneously configured to run in IIS5 Compatibility Mode (W3SVC/IIs5IsolationModeEnabled=1) AND WOW64 mode (W3SVC/AppPools/Enable32BitAppOnWin64=1). This is actually an invalid IIS configuration, but due to the sequence of configuration events, an interesting failure condition occurrs - W3SVC fails to start up due to Win32 Error 193 when it never loads the bitness-mismatched user binary. Here is what happens:

  1. IIS6 is configured to run in IIS5 Compatibility Mode (W3SVC/IIs5IsolationModeEnabled=1)
    • This means that ISAPI Filter DLLs will run inside of the inetinfo.exe process.
    • Now, inetinfo.exe is a 64bit process because it needs to read %SYSTEMROOT%\System32\inetsrv\metabase.xml for IIS configuration.
    • The reason that inetinfo.exe cannot be a 32bit process is because WOW64 FileSystemRedirection will be in effect for all non-excluded filepaths under %SYSTEMROOT%\System32 (this is an OS-level behavior). Having duplicate metabase.xml under both System32 and Syswow64 directories is simply bad design... for example, imagine change synchronization...
  2. IIS6 is then configured to run in WOW64 Mode (W3SVC/AppPools/Enable32BitAppOnWin64=1)
  3. ASPNET_REGIIS.EXE -I -Enable from the 32bit Framework directory is run, which changes W3SVC/Filters/ASP.Net_2.0.50727.42/FilterPath to load the 32bit ASP.Net ISAPI Filter DLL from %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll .
  4. IIS is then restarted to load the global ISAPI Filter.
  5. When W3SVC starts, it goes down two totally different initialization paths depending on whether IIS5 Compatibility Mode is enabled. In this case, it is enabled, so W3SVC communicates with the worker process core, now loaded in inetinfo.exe (instead of w3wp.exe - this is one major difference for IIS5 Compatibility Mode), to start up.
  6. Worker process core in inetinfo.exe, a 64bit process, tries to load global ISAPI Filters as a part of initialization (this is for IIS5 Compatibility Mode - global ISAPI Filters must load at service startup, unlike the demand-start of Worker Process Isolation Mode).
  7. From step #3, a 32bit aspnet_filter.dll is configured to load... into the 64bit inetinfo.exe process... which dutifully fails with Win32 error 193 (0x800700C1).
  8. Worker process core reports this error back to W3SVC and aborts startup because failure to load ISAPI Filter is a fatal failure on IIS6 (unlike on IIS5, where ISAPI Filters implementing security features can fail to load and IIS still continues).
  9. W3SVC also treats this failure as fatal and aborts. This eventually results in ExitProcess() being called, which causes SCM to report the failure to start the W3SVC service.

The Solution...

In this case, the fix is to resolve the invalid configuration of attempting to run IIS5 Isolation Mode and WOW64 simultaneously. Either choose to run in IIS5 Compatibility Mode and keep things 64bit, or run in IIS6 Worker Process Isolation Mode with WOW64. Due to the oxymoron stated earlier, I suspect that 99.9% of the time you will choose to run in IIS6 Worker Process Isolation Mode with WOW64. I mean, 64bit ISAPI Filter which requires ReadRawData is rare commodity, most likely generated by self-interest. :-)

This means that you should run the following:

 CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/IIs5IsolationModeEnabled 0
NET STOP HttpFilter /y
NET START W3SVC

To switch IIS6 back into Worker Process Isolation Mode, and since you already have WOW64 enabled and 32bit DLLs correctly configured, things should just work... assuming you covered all other bases regarding WOW64 and possible bitness mismatch mentioned in my prior blog entries.

//David

Comments

  • Anonymous
    February 27, 2006
    The comment has been removed
  • Anonymous
    February 27, 2006
    Eli - Thanks. Fixed it.

    For the curious - I type in the Dvorak keyboard layout, and 'S' and 'L' are next to each other on the right pinky finger ( Dvorak 'S' = qwerty ';' and Dvorak 'L' = qwerty 'P').

    //David
  • Anonymous
    March 19, 2006
    One of the cooler but definitely unsung feature of the IIS7 Server Core is PreConditions. So, that's...
  • Anonymous
    March 23, 2006
    Just wanted to thank you for the useful post. I had this problem, and this solution is just what I was looking for. Thanks a lot!
  • Anonymous
    April 24, 2006
    I hv a problem IIS is stopped and when trying to start it we are geting the Error Msg "The service did not respond to the start or control request in a timely fashion"

    We tried ReInstalling IIS but it dnt work. Pls give us a suggestion
  • Anonymous
    April 24, 2006
    I hv a problem IIS is stopped and when trying to start it we are geting the Error Msg "The service did not respond to the start or control request in a timely fashion"

    We tried ReInstalling IIS but it dnt work. Pls give us a suggestion
  • Anonymous
    April 24, 2006
    The comment has been removed
  • Anonymous
    May 12, 2006
    Fantastic, after about 6 hours of messing around and getting these obtruse errors, 5 minutes with your BLOG sorted me out and I'm now happy debuging ASP.NET1.1 apps on VS2003 on my XP64 machine. star!
  • Anonymous
    May 12, 2006
    Craig - glad to hear that your issue is resolved.

    Running 32bit applications in WOW64 on 64bit OS is definitely not for the faint hearted.

    And getting ASP.Net 1.1 running on 64bit OS is one of the most confusing configurations (considering it was never designed to run on 64bit OS).

    Other confusing combinations include getting ASP.Net 1.1 AND ASP.Net 2.0 running on a 64bit OS side-by-side... oy.

    //David
  • Anonymous
    August 27, 2006
    The comment has been removed
  • Anonymous
    August 27, 2006
    The comment has been removed
  • Anonymous
    July 09, 2007
    Hello! I'm novice here and I want to ask for some help. Can you give me any info and some links where I can get general help on using forum. I think that this info can be usefull not only for me. Thanks a lot! P.S. Pardon me for my making this topic in wrong section

[url=http://xgloq.net/Amarillo-Texas]Amarillo[/url]...I'm lovin' it :)

  • Anonymous
    October 27, 2007
    Hi, I have a friend trying to update .net framework 1.1 SP1 but failed with error message "Failed to delay load libary MSCORLIB.DLL (win 32 error: 193)". I tried to search the error message online  but could not find any thing. Your help will be appreciated. Thanks.

  • Anonymous
    February 14, 2008
    okay, you totally fixed my problems. Thanks!

  • Anonymous
    October 14, 2008
    hai im using Windows Vista Business Version. IIS is running in my system but when im using it im getting some error as Unrecognized configuration section 'ConfigprotectedData' as an error. how can i over come this problem? please reply me...