Recently I was deploying a Windows Service that uses SAP .NET Connector 3.0 on a fresh install of Windows (the specific version isn’t important, but it was Windows Server 2003). I built my installer package, installed .NET Framework 4, and installed my program. When it came time to execute my service, I received the following error message.
System.TypeInitializationException: The type initializer for 'SAP.Middleware.Connector.RfcServerManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SAP.Middleware.Connector.RfcConfigParameters' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'sapnco_utils.dll' or one of its dependencies. The specified module could not be found. at SAP.Middleware.Connector.RfcConfigParameters..cctor() --- End of inner exception stack trace --- at SAP.Middleware.Connector.RfcConfigParameters.Initialize() at SAP.Middleware.Connector.RfcServerManager..cctor() --- End of inner exception stack trace --- at SAP.Middleware.Connector.RfcServerManager .GetServer(String serverName, Type[] rfcFunctionHandlers) at DataXstream.AwesomeProduct.InitializeSap()
What was really confounding was that the Fusion Log reported no .NET binding errors! So, what was going on?
Missing Prerequisite!
It turns out that I was missing a prerequisite. In addition to .NET Framework 4, SAP .NET Connector (NCo) 3.0 Microsoft Visual C++ 2010 Redistributable Package (mscvp100.dll, mscvr100.dll). After I installed it, everything ran like a champ! I was a little miffed that the OSS Note I was using as my guide (856863) made no mention of the Microsoft Visual C++ 2010 prerequisite. So, for all of you that may have similar issues, here is a comprehensive installable prerequisite list (with links!) for the SAP .NET Connector (NCo) 3.0 separated by your program’s target processor architecture and .NET version:
NCo 3.0 32-bit (x86), .NET 2.0 (also 3.0, and/or 3.5)
- .NET Framework 2.0 or .NET Framework 3.0 or .NET Framework 3.5
- Microsoft Visual C++ 2008 Redistributable Pack (x86) (mscvp80.dll)
NCo 3.0 64-bit (x64), .NET 2.0 (also 3.0, and/or 3.5)
- .NET Framework 2.0 or .NET Framework 3.0 or .NET Framework 3.5
- Microsoft Visual C++ 2008 Redistributable Pack (x64) (mscvp80.dll)
NCo 3.0 32-bit (x86), .NET 4.0
- .NET Framework 4.0 (Full Package)
- Microsoft Visual C++ 2010 Redistributable Pack (x86) (mscvp100.dll)
NCo 3.0 64-bit (x64), .NET 4.0
- .NET Framework 4.0 (Full Package)
- Microsoft Visual C++ 2010 Redistributable Pack (x64) (mscvp100.dll)
One More Thing!
It is important to understand the relationship between your .NET project’s target platform and the prerequisites. The 64-bit version of the Microsoft Visual C++ 2010 Restributable Pack will not work if your project’s target is for a 32-bit architecture. Be mindful to match the project platform to the prerequisite.
Thank you for your amazing explanation.
Finally, my problem is solved!
Regards,
Thanks a lot. This was exactly what I was looking for.
Great solutions. worked for me.
Thanks a lot!!! Been struggling for days and this was what I was looking for!
In my case i had to add the reference sapnco_utils.dll to the web site properties page (shift+F4) references.
(besides the bin folder)
regards
Thanks a lot!!! problem solved!!!
Thanks a lot..
Saved Lot of time
It works for me too
Thanks a lot!! It’s helpful.
Just a small correction: the .NET 2.0 versions of NCo require the Microsoft Visual C++ runtime 2005 SP1, not 2008.
See https://service.sap.com/connectors –> SAP Connector for Microsoft .NET –> Prerequisites
This is awesome, helped me fix the issue. Thanks much!!
You, my friend, are the best. Thanks for share this post, help me a lot!