cancel
Showing results for 
Search instead for 
Did you mean: 

sap nco dlls problem

Former Member
0 Kudos

Hello everybody,

I am having quite some trouble for the last few days about creating a wcf service that needs to connect to sap. My system is 64 bit version, I have downloaded sapnco version 3.0 64 bit version from service.sap.com. I had the service up and running and then I added the two dlls to the project, built the project successfully, but since then I am getting the error about some dll dependencies. I removed the sapnco dlls from the project, but problem still remains.

"

Could not load file or assembly 'WcfService3' or one of its dependencies. An attempt was made to load a program with an incorrect format.

"

I have never had a problem like this before, I have been using these dlls successfully in some windws forms applications and to my surprise, there is still no error like this if I create winforms or consoleapp. I have seen lots of threads with exact this problem, but the solutions do not seem to work for me. My solution platform is set to x64.

This issue has been plaguing me for the last couple of days and as I read, it is commonly thought to be ambiguity between 32/64 bits resources, but I think do not use anything built in 32 bits. Can somebody please suggest some kind of solution to this? I think it is a pretty common issue, I just could not find it. I have also traversed the dependencies using dependency walker but everything seems ok there.

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

Sometimes you can "think" you're not, but you are.  64-bit sapnco DLLs can't have ANY 32-bit DLLs in the bin folder of the application using them.  I will attempt to upload and attach a VB.NET console app that can "sniff" your bin directory for 32-bit dlls.  If it finds one it will print "Required32bit." (see screen cap).

Console app solution can be downloaded here: https://SSend.it/f0lfuq   (https  SSend.it/f0lfuq << if link is broken, try entering link in address bar).

Former Member
0 Kudos

Hi Case,

thank you very much for the tool, it is very handy. I have checked the bin directory of my service and dlls seem ok, here is the screenshot:

Answers (2)

Answers (2)

former_member197445
Contributor
0 Kudos

Two more suggestions:

  1. Make sure the application pool for the WCF web site does not allow 32-bit.
  2. If you are getting the error only while debugging locally and not on the deployment server, try this --

IIS Express runs as 32-bit by default. To change that, a registry entry must be created for the Visual Studio IDE version you have installed.


 

VS 2010


 

 

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\WebProjects /v Use64BitIISExpress /t REG_DWORD
  /d 1


 

 

VS 2012


 

 

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\WebProjects /v Use64BitIISExpress /t REG_DWORD
  /d 1


 

 

VS 2013


 

 

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects /v Use64BitIISExpress /t REG_DWORD
  /d 1


 


... or if you want to run regedit and add the keys manually, just ignore the "reg add" part and create DWORD "Use64BitIISExpress" with value "1".

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Lasha,

an application always needs to be bit-clean that means either everything in 32-bit or 64-bit not mixed. In addition make sure that the fitting 64bit VS runtime libraries have been installed. VS 2005 SP1 for .NET 2.0, VS 2010 for .NET 4.0.

Best regards,

Markus

Former Member
0 Kudos

Hi, thank for your suggestions.

Markus, yes I have seen some people claiming that helped them overcome this error and I installed redist package from this link. http://www.microsoft.com/en-us/download/details.aspx?id=13523. It is interesting now I checked my programs and I have seen this:

Could these be the cause of the problem? I do not recall installing them myself, but maybe they come with SAP GUI or something, as SAP is publisher.