Fail to load DLL in Windows 2008 R2 having full permissions control
I have developed an C# application that run very well in local.
But there is a problem when i put on the server.
The application uses a DLL library in his references (A.dll) and in a point of the execution the A.dll creates in the Temp directory another DLL (embedded in it, let's call it B.dll). But when the A.dll try to load the B.dll an exception is threw:
system.invalidoperationexception: failed to load B.dll
I have not access at the DLLs source, are libraries.
So recap:
So at this point I think that is a security problem on the server, like "Processes cannot load DLLs" or something similar.
The exception: http://i.imgur.com/NmB2Fth.png?1
Anyone can suggest me any solution? Would i check better? Where?
PS IF i try to register the dll i got the same error of this: Register DLL file on Windows Server 2008 R2
The solution was simple.
I have used a very useful tool named Event Viewer (Start->Execute->eventvwr.exe) When i started my application a new error event was showed on the Windows Logs->Applications:
Activation context generation failed for "C:TempAPPmyfile.dll".
Dependent Assembly Microsoft.VC90.CRT,processorArchitecture="x86",
publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found.
Please use sxstrace.exe for detailed diagnosis.
A quick search and the result was that the server needed the Visual C++ Runtime for x86
(x86 because my application works in the 32bit application pool)
Once installed this package: http://www.microsoft.com/en-us/download/details.aspx?id=5582
Everything worked like a charm.
I hope this will help anyone to save some time!!
链接地址: http://www.djcxy.com/p/44460.html