Get your (old) COM-based or "ASP.NET with Interop" web app working in Windows Server 2003 R2 64 Bit

서버/IIS 2010. 6. 15. 14:51
You have windows 2003 R2 64 bit SP1. You have the 64bit version of the .NET framework (V2 or higher) installed. No other changes have been made to IIS - it seems to run just fine for serving .NET and HTML. You install your web application that includes COM, try to run it, and BANG...
Microsoft VBScript runtime error '800a01ad' 
ActiveX component can't create object
The cause? Its because those COM objects are 32 bit components, and by default IIS won't work with 32 components. You need to tell IIS to run in 32 bit compatibility mode (WOW64). To do this, you need to configure IIS to run in 32 bit compatibility mode, as explained by this link.
But wait! Its not quite that easy! If you do this, then you're telling IIS to run in 32 bit mode, but then you've already got the 64 bit ASP.NET DLL's registered with IIS, so the first time you hit your app, you'll probably see a big fat "Service Unavailable" Error message. If you look in the event log, you'll see your application pools are crashing with this error:
A process serving application pool 'DefaultAppPool' reported a failure.

The process id was '4156'. The data field contains the error number.
So, you need to register the 32 bit ASP.NET DLL's with IIS. But wait! You can't do that before you un-register the existing 64 bit ones.
Enough waffling. Here's the step-by-step :-

1. Un-register the 64 bit ASP.NET DLL's. In a command prompt, navigate to C:\Windows\Framework64\v2.0.50727\ and from there run "aspnet_regiis -u"
2. Set IIS to work in 32 bit compatibility (WOW64) mode: 
cscript c:\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32BitAppOnWin64 1
3. Register the 32-Bit ASP.NET DLL's. Navigate to C:\Windows\Framework\v2.0.50727\ and from there run "aspnet_regiis -i"
4. Finally, in IIS, Navigate to "Web Service Extensions", and make sure that ASP.NET is "allowed".
: