Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAPbobsCOM not working

Tags:

c#

.net

iis

com

sap

I developed a web application using asp.net C# to place online orders. my app. works fine on SAP server (windows 2008 R2) but when I copied my project to my local machine (runs windows 7) I got an error, can't see the SAPbobsCOM reference. I don't have SAP API DI on my machine
I tried to debug my application in X86 to solve the problem. but no luck. this is the error I got enter image description here

Retrieving the COM class factory for component with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

thank you

like image 522
Sam Avatar asked Mar 24 '14 17:03

Sam


3 Answers

The problem is caused by having Any CPU platform target selected for your app.

This means your app could run as both 32x and x64 process depending on a .NET runtime bitness executing your app. If your process runs as x64 and you have 32x DI API installed (or vice versa), you get this issue, since DI API requires loading native DLLs into your process. However, 32x DLLs couldn't be loaded into a x64 process and vice versa.

That's why we have to explicitly allow the exact same bitness for your app as the DI API bitness it would use.

To do this:

  • first, have SAP DI API (c:\Program Files\SAP\SAP Business One DI API\) and SAP Business One SDK (c:\Program Files (x86)\SAP\SAP Business One SDK\) installed
  • next, figure out which version (x86 or x64) of DI API you have. If it's installed in c:\Program Files - you have x64 version and if it's in c:\Program Files (x86)\ - you have x86 one
  • finally, go to your Project properties -> Build tab and set the same Platform target that your DI SDK version is: enter image description here
like image 166
Alexander Abakumov Avatar answered Nov 20 '22 06:11

Alexander Abakumov


I had the exact same issue. My SAP components was running in a WCF service.

To fix the issue changed the application pool to run under 32-bit.

like image 5
Ewald Avatar answered Nov 20 '22 06:11

Ewald


I got the same problem. It was because the SAP Business One references SAPbobsCOM and SBODI_Server were missing. I added these references and it worked. You need to add SAP DI API on your machine for using SAPbobsCOM reference.

like image 1
Ravi Sharma Avatar answered Nov 20 '22 06:11

Ravi Sharma