Partager via


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

  • Anonymous
    November 03, 2007
    Rakki Muthukumar is a Microsoft Developer Support Engineer for ASP.NET and IIS7. If you haven't seen

  • Anonymous
    November 04, 2007
    Wow, this is cool stuff. Good info on IIS7

  • Anonymous
    November 07, 2007
    The IIS7 community is growing!&#xA0; There have been a number of really cool things going on in the community

  • Anonymous
    November 07, 2007
    The IIS7 community is growing!&amp;#xA0; There have been a number of really cool things going on in the

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

  • Anonymous
    April 07, 2008
    Here's a thing that haunted me the last few days: I have this 64bit Windows Server 2K8 machine which

  • Anonymous
    July 29, 2008
    Useful Info: Running x64 and x86 IIS Worker Processes Side-By-Side

  • Anonymous
    July 29, 2008
    Useful Info: Running x64 and x86 IIS Worker Processes Side-By-Side

  • Anonymous
    August 03, 2008
    The comment has been removed

  • Anonymous
    November 27, 2008
    This posting is provided "AS IS" with no warranties, and confers no rights. Well, I guess most ASP.NET

  • Anonymous
    January 12, 2009
    Gotchas: Migration from IIS6 SQL 2005 (32-bit) to IIS7 SQL 2008 (64-bit)

  • Anonymous
    May 01, 2009
    Thanks for the post, it helped me in resolving the case. :) BINGO

  • Anonymous
    July 27, 2009
    Thanks Rakki. This resolved the issue faced by our team.

  • Anonymous
    September 18, 2009
    I don't know how to thank you. you saved my day

  • Anonymous
    September 24, 2009
    Thank You! This is the first clear explanation I have seen.

  • Anonymous
    November 19, 2009
    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

  • Anonymous
    February 02, 2010
    This one made my day´. Thanks a million Rakki!

  • Anonymous
    February 26, 2010
    Thank you, thank you, thank you!

  • Anonymous
    August 27, 2010
    FINALLY Someone can explain how to solve this!!! Thanks very much!!

  • Anonymous
    March 29, 2011
    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/

  • Anonymous
    April 29, 2011
    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

  • Anonymous
    May 01, 2011
    @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!

  • Anonymous
    June 13, 2011
    thank you for this solution. i searched many hours in my project-settings and projekt-links. but it was only one setting in iis.

  • Anonymous
    November 21, 2011
    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.

  • Anonymous
    August 04, 2014
    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