tags:

views:

39

answers:

2

I have a ASP.NET "website" which uses a 32-bit dll. When I XCOPY to our 64-bit server, the page which uses this 32-bit dll throws an exception. I've already set the "Enable 32-Bit Applications" to True for the App Pool the site runs on but that doesn't help.

I'm also trying to set the target platform to x86 but the Website has no option for it unlike a Web app.

Here's the stack trace -

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 7/13/2010 5:01:12 PM 
Event time (UTC): 7/13/2010 9:01:12 PM 
Event ID: 9611671ef6b845f39af6b26b89af85e3 
Event sequence: 51 
Event occurrence: 4 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/2/ROOT-1-129235271319338750 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\Site\ 
    Machine name: WWWTEST 

Process information: 
    Process ID: 4020 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\WWWTEST AppPool 

Exception information: 
    Exception type: COMException 
    Exception message: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed due to the following error: 80040154. 

Request information: 
    Request URL: http://site/Downloads.aspx 
    Request path: /Downloads.aspx 
    User host address: 192.168.1.101
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: WWWTEST\Webtest 

Thread information: 
    Thread ID: 4 
    Thread account name: WWWTEST\Webtest 
    Is impersonating: False 
    Stack trace:    at Downloads.Button_Click(Object Sender, DataGridCommandEventArgs E) in C:\Site\Downloads.aspx.vb:line 1034
   at System.Web.UI.WebControls.DataGrid.OnItemCommand(DataGridCommandEventArgs e)
   at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I did an online search for the exception "Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed due to the following error: 80040154." and enabled the 32-bit mode on IIS7 but still no luck.

Any help is greatly appreciated.

** ANSWER ** I was able to fix this issue with the help from user Kev. Here's what I did -

  1. Download Microsoft Developer Support OLE File Property Reader 2.1 Sample (KB 224351) from here
  2. Extract the contents to a temp folder using WinZip/7-zip etc. Don't run the Setup. Copy the files "Interop.DSOFile.dll" and "dsofile.dll" from the extracted location over to the bin directory of the app on the Server.
  3. Open a cmd prompt with Admin rights and navigate to the bin directory on the Server
  4. Type in "regsvr32 dsofile.dll"
  5. Make sure the App Pool is set to Enable 32-Bit applications.
  6. Restart IIS

Thank you very much, Kev. I really appreciate it.

A: 

You probably need to set the application pool the app is running in to run as x86.

Achilles
Is that different from enabling "Enable 32-Bit Applications" on the app pool?
@tempid - no there is no such setting. You did the right thing setting `Enable 32-Bit Applications` to true.
Kev
+1  A: 

This sounds like the COM component isn't registered on the server. You need to copy the component (dsofile.dll) to the server and run regsvr32.exe to register it:

regsvr32 dsofile.dll

You also need to make sure that the account that the website runs under has read access to this file or its containing folder.

It might also be worth trying building your project and changing the build to target x86 instead of Any CPU, though I doubt that's the problem.

Kev
I tried registering the COM on the Web server but it errors out saying "The module was found but the DllRegister Server entry point was not found." There is no way of setting the target to x86 as this is a Web site project.Any other ideas?
@tempid - show me the command line you used.
Kev
Here you go -regsvr32 /i "c:\Interop.DSOFile.Dll"
@tempid - see updated answer. You don't register the interop file. That's just a managed .NET wrapper to plumb into the COM infrastructure. You also need to register the underlying component itself which is contained inside dsofile.dll.
Kev
Yes, I'm the admin on the box.
Kev, do you know how to find the underlying COM used by the DSOFile.dll?
Ok...on the server did you run the DSOFile installer?
Kev
I couldn't find the DSOFile installer on the local machine.I looked up online and it looks like its installed by -"Office 2003 Add-in: Office Web Components". I downloaded the file from Microsoft and ran the setup on the server and restarted IIS but still no luck.
PM me. See my profile for Messenger addy.
Kev
@tempid - why not update your question with this info. Tack it on the end. It'll be easier for other users to spot if they encounter the same problem.
Kev