Oracle and .NET on 64-bit Windows

Posted by Adrian O'Connor Tue, 07 Aug 2007 12:52:00 GMT

If you have moved your .NET development to one of the new 64-bit Windows platforms, and you make use of the Microsoft supplied Oracle Client for .NET you might be experiencing serious problems with compatibility.

The the Oracle Client supplied by Microsoft cannot run in 64-bit mode; it is a 32-bit image that a 64-bit thread simply can’t load. In the past month Oracle have released a 64-bit version of their own ODP.NET, but I haven’t tested it. This will likely work well if you don’t mind the extra over-head of having to install and manage ODP.NET, but it doesn’t sovle the problem for us – we have standardised our servers to run the same environment, and that means the Microsoft client.

The solution is to run your application in 32-bit mode. In Visual Studio 2005 you can change your project to run in 32-bit mode using the configuration manager (Build -> Configuration Manager…)

In the Configuration Manager, choose “” from the “Active solution platform:” field, and select x86 in the “Type or select the new platform” list. Click OK.

This only applies to the active configuration – most often this is Debug. You can do the same for Release if need be (in the same window).

IIS

But that doesn’t help ASP.NET applications that connect to Oracle, they’ll still fail, even if you’re compiled for x86. You actually need to flip IIS over to 32-bit mode—this will affect all IIS sites and applications.

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 “true”

You will probably need to restart your server, seeing as this is Windows™. Once done, IIS will spawn 32-bit worker processes and these can load 32-bit DLLs, including the Oracle driver (and other ISAPI filters).

Is 64-bit Windows worth it?

No. Absolutely not. Apart from the problems described here you will have to deal with drivers that don’t really work and Explorer freezing all of the time.

Comments

Leave a response

Comments