How to build a C# MVC app with a 32-bit assembly to run on x64 Server 2008
We have a MVC application that depends on a number of 3rd party products (e.g., Crystal, Topaz). The Topaz signature device only has 32-bit .dlls available. So I'm assume that I need to build and deploy the app on IIS 7 in an a 32-bit App Pool.
If that assumption is correct, then do I need to build the MVC app with the VS2008 compiler setting to "x86" (right now I'm u开发者_开发技巧sing "Any CPU"?
Also, do all the referenced assemblies need to be 32-bit as well? If so, how do I get 32-bit MVC files onto a x64 Server 2008?
Finally, how do I make the inetpub/ directories x86 friendly, or does that magically happen as a consequence of something else?
If that assumption is correct, then do I need to build the MVC app with the VS2008 compiler setting to "x86" (right now I'm using "Any CPU"?
you can set it to any CPU and it will run on 32 bit or 64 bit, depending on your app pool settings and as long as your other dependent dlls are also compiled with "any CPU"
Also, do all the referenced assemblies need to be 32-bit as well? If so, how do I get 32-bit MVC files onto a x64 Server 2008?
If you are using unmanaged code (or reference assemblies) you need to get the specific 32 bit and 64 bit version of that assembly.If you have 32 bit assemblies and if you enable 32 bit applications in your app pool, they would be run in WoW64 mode
another reference: http://blogs.msdn.com/gauravseth/archive/2006/03/07/545104.aspx
If you have x64 version,they would be run natively as 64 bit
The Topaz signature device only has 32-bit .dlls available. So I'm assume that I need to build and deploy the app on IIS 7 in an a 32-bit App Pool.
How did you verify it? Did you use Corflags.exe ? You can know more about it here. Regardless of your PE header (PE32 or PE32+) if your 32BIT is set to 0, you can run it on a 64 bit app pool.Even if it is set to 1 and if it is not signed, you can set it to 0 (but might not be worth taking the risk) and run it on 64 bit app pool
Does it matter if your MVC app runs as 32-Bit? Or do you have a compelling reason to try to go to 64-Bit?
If you can live with 32-bit, complile all of your assemblies as x86. When you configure IIS on your x64 server 2008, make sure to update the "Advanced Settings" on your app pool -set "Enable 32-Bit Applactions" to true.
Patrick
If that assumption is correct, then do I need to build the MVC app with the VS2008 compiler setting to "x86" (right now I'm using "Any CPU"?
Yes, entirely correct.
Also, do all the referenced assemblies need to be 32-bit as well? If so, how do I get 32-bit MVC files onto a x64 Server 2008?
No need, if those assemblies are built as ANY CPU, then the .Net framework will resolve it to 32 bit, as long as your entry assembly is 32 bit.
Finally, how do I make the inetpub/ directories x86 friendly, or does that magically happen as a consequence of something else?
It just happens magically.
精彩评论