cancel
Showing results for 
Search instead for 
Did you mean: 

Could not load file or assembly 'sapnco' or one of its dependencies.

Former Member
0 Kudos

I am building ASP.NET using the SAP.Net Connector, latest version. It works correctly on development machine. However, when I deployed it, I get the error, "Could not load file or assembly 'sapnco' or one of its dependencies. An attempt was made to load a program with an incorrect format. " Anyone has any issue with this would like to share some hints. Thanks.

I had also deployed the latest vc++ redistributed package for both x64 and x86 with no help.

Accepted Solutions (0)

Answers (3)

Answers (3)

fammageo
Member
0 Kudos

Great, Thanks!

I just start a new project and this solve this situation:

System.BadImageFormatException: 'Could not load file or assembly 'NSAPConnector, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'

**************

The package I did install was: Install-Package NSAPConnector_x64

So the VS project properties did need to set to x64 tool

Regards

Former Member
0 Kudos

Be sure all the Build Platform architecture and corresponding References in all projects are for the same architecture. For example, if in your Configuration Manager you are compiling for a x64 Platform, and you have a reference to the x86 version of sapnco in your project, it will cause this error. Interestingly Visual Studio doesn't show it in the Error List as a compiler Error List as a hard error.

Cheers,

Matthew

Former Member
0 Kudos

HI Frank Do,

Please check sapnco.dll and all dependency .dll's are available in bin folder of your virtual directory. Those are mandatory to add for your virtual directory.

Best Regards,

Harish.Y

Former Member
0 Kudos

Actually, .Net deployment miss to include the rscp4n.dll file. I copied the file and put it into the bin folder along with sapnco.dll and sapnco_utils.dll, which were correctly deployed using the deployment feature; however, now I am getting the same error for 'rscp4n.dll'.

Had you tried it yourself and had it worked in asp.net app on your windows 2008 hosting server?

Appreciate your respond but that does not help me, I can't give you credit for answering my question. Thanks.

Former Member
0 Kudos

Could not load file or assembly 'rscp4n' or one of its dependencies.

Former Member
0 Kudos

I found the solution. If you are hosting under IIS7. You need to, first Enable 32-Bit Applications in your app pool (I am not using 64-bits hosting), and you need to change managed pipeline mode to classic. After restart application pool, it seems to work for me.