IIS7 – Running 32-bit and 64-bit ASP.NET versions at the same time on different worker processes


In IIS6, this was a pain area. On a 64-bit Windows 2003 Server, you cannot run worker processes in both 32-bit mode and as well as 64 bit mode. Either only one of them was possible. This was possible by the below Metabase Key which would be applied to the W3SVC/AppPools node.


W3SVC/AppPools/enable32BitAppOnWin64 : true | false


Read more how to do this in IIS 6.0 here. But, in IIS7, you can run 32-bit and 64-bit worker processes simultaneously. Let’s see how to do it.

You have the same enable32BitAppOnWin64 property for the applicationPools in the applicationHost.config. Now, you can set this for individual application pools. Below is my sample configuration:



<applicationPools>
 <add name=”MyAppPool32bit” autoStart=”true” enable32BitAppOnWin64=”true” />
 <add name=”MyAppPool64bit” autoStart=”true” enable32BitAppOnWin64=”false” />
  <applicationPoolDefaults>
   <processModel identityType=”NetworkService” />
  </applicationPoolDefaults>
</applicationPools>

Below is how you do it from IIS7 manager:


  1. Right click on the Application Pool and select “Advanced Settings…” or select the same from the Actions pane after selecting the Application pool

  2. Change the “Enable 32-bit Applications” to True (if you want the application pool to spawn in a 32-bit mode)

  3. Click OK

Below is how you do from the AppCmd:


appcmd set apppool /apppool.name:MyAppPool32bit /enable32BitAppOnWin64:true



appcmd set apppool /apppool.name:MyAppPool32bit /enable32BitAppOnWin64:false



NOTE : By default, it is false.


Most of you may already know how to see if the process is really spun in a 32-bit mode in 64-bit OS. Yes, simple way is to open the Task Manager and go to Processes tab – you would see the below:



Now, you may ask how does the correct version of the DLLs picked up automatically. Open your applicationHost.config and search for aspnet_filter. You would see the below:



<isapiFilters>
    <filter name=”ASP.Net_2.0.50727.0″ path=”%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll” enableCache=”true” preCondition=”bitness32″ />
    <filter name=”ASP.Net_2.0.50727-64″ path=”%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll” enableCache=”true” preCondition=”bitness64″ />
</isapiFilters>

The preCondition=”bitness32” or “bitness64” decides which ISAPI Filter to pick up for corresponding modes. Same case with any DLL used, for example ISAPI Filter, Modules, etc.


Happy Learning!

Comments (25)

  1. Rakki Muthukumar is a Microsoft Developer Support Engineer for ASP.NET and IIS7. If you haven’t seen

  2. Saurabh Singh says:

    Wow, this is cool stuff.

    Good info on IIS7

  3. The IIS7 community is growing!&#xA0; There have been a number of really cool things going on in the community

  4. The IIS7 community is growing!&amp;#xA0; There have been a number of really cool things going on in the

  5. rox19840702 says:

    Nov 17th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, VS 2008, .NET 3.5, IIS7, Silverlight

  6. Here’s a thing that haunted me the last few days: I have this 64bit Windows Server 2K8 machine which

  7. Useful Info: Running x64 and x86 IIS Worker Processes Side-By-Side

  8. Useful Info: Running x64 and x86 IIS Worker Processes Side-By-Side

  9. Darren Sandford says:

    Some installer that I ran recently broke my Virtual Server configuration page – all I got was a IIS error.

    Turns out that it added an extra element into my "isapiFilter" element:

       <filter name="ASP.Net_2.0.50727.0" path="C:WindowsMicrosoft.NETFrameworkv2.0.50727\aspnet_filter.dll" enableCache="true" />

    Hard-coded path, and with the "bitness" filter removed.  As virtual server is 64 bit, it broke it.

    I deleted the line, and all is now well!

  10. This posting is provided "AS IS" with no warranties, and confers no rights. Well, I guess most ASP.NET

  11. Gotchas: Migration from IIS6 SQL 2005 (32-bit) to IIS7 SQL 2008 (64-bit)

  12. Mubashir says:

    Thanks for the post, it helped me in resolving the case. 🙂

    BINGO

  13. PG Kirsh says:

    Thanks Rakki. This resolved the issue faced by our team.

  14. vijay says:

    I don't know how to thank you. you saved my day

  15. Barry says:

    Thank You! This is the first clear explanation I have seen.

  16. marx says:

    Thanks for the info – didn't work exactly as described – here's what worked for me on Win 2008 R2:

    .appcmd.exe set apppool "my app pool" /enable32BitAppOnWin64:true

  17. Matz says:

    This one made my day´. Thanks a million Rakki!

  18. Dave says:

    Thank you, thank you, thank you!

  19. Patrick says:

    FINALLY Someone can explain how to solve this!!! Thanks very much!!

  20. emubd says:

    i like this solution.thank you for giving a nice solution.but i have gotten a better solution in other site.this site below

    In my workstation I have used 32bit PC. There is no problem every this is working nice. But an unexpected situation arise recently when I try to deploy my application in to a 64 bit windows server. I never face this problem before…..more

    http://aspboss.blogspot.com/

  21. Devang Patel says:

    can you tell me where to write following code in web.config?

    —–

    <applicationPools> <add name="MyAppPool32bit" autoStart="true" enable32BitAppOnWin64="true" /> <add name="MyAppPool64bit" autoStart="true" enable32BitAppOnWin64="false" />  <applicationPoolDefaults>   <processModel identityType="NetworkService" />  </applicationPoolDefaults></applicationPools>

    waiting for reply

  22. @Devang – You need to have those in the applicationHost.config. That's where your configurations related to the IIS server runtime will be stored.

    This section is located under <system.applicationHost>

    Hope this helps!

  23. gerhard says:

    thank you for this solution. i searched many hours in my project-settings and projekt-links.

    but it was only one setting in iis.

  24. JGR says:

    This just saved my life with an implementation I am making where the ODBC driver is 32-bits but we need to connect using an ASP.NET application in a Windows Server 2008 64-bit.  Excellent piece of information and article.

  25. basheer says:

    Excellent, really apps users without knowing 32 /64 installed their apps and escalate the internal err 500 / after changed to "enable 32bit applications" =True it works !!. Great posting. Thanks