tags:

views:

1443

answers:

1

reading excel files from C# working well in 32 bit version server. It is not working in 64 bit version (Windows 2003 server), because excel data connection dll not supported in 64 bit version. Is any other option available ?

+3  A: 

In your project properties set the target platform from 'Any' to 'x86'.

Details:

In Windows x64 a process may be started as 32bit or 64bit process. A 64bit process can only load 64bit dlls and a 32bit process only 32bit dlls.

If your platform target (e.g. specified in the project properties) of your .Net application is set to "Any CPU", the intermediate code will be compiled to 32bit or 64bit code depending on the target platform, i.e. on a x64 system 64bit code will be generated.

Therefore the code can no longer load a 32bit dll.

If your code loads unmanaged assemblies you should always specify the target platform explicitly

0xA3
Thanks for your response.I have used the MDAC drivers to read the excel file i.e string strConn; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\exceltest.xls;" + "Extended Properties=Excel 8.0;"; but MDAC is not available for x64 bit version
guna Samba
Yes, and because the driver is a 32 bit application you have to make your .NET assembly a 32-bit assembly too by setting the project's target platform to 'x86'.
0xA3
apart from project target platform, are we need to configure IIS services in production server
guna Samba
Is the problem not solved by changing the target platform?
0xA3
how can i change the IIS configuration, I have changed the platform in Dotnet Projects
guna Samba
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 “true”
0xA3
(see http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/405f5bb5-87a3-43d2-8138-54b75db73aa1.mspx?mfr=true)
0xA3
thanks for your response. I have tried this, but after the mode has been changed. "service unavailable" error has occured while running the application
guna Samba
I have solved the problem, after enabling the 32 bit mode, we need to register the iisreg for 32 bit and we need to enable the 32 bit mode in web service extension
guna Samba