Why doesn't .NET find the OpenSSL.NET dll?

前端 未结 12 1054
无人及你
无人及你 2020-12-10 05:57

EDIT (the whole question, it was too unclear)

I want to use OpenSSL.NET

The OpenSSL.NET install instructions page: INSTALL

相关标签:
12条回答
  • 2020-12-10 06:37

    I found a solution.

    Unfortunately the VS2008 C++ Redistributable package didn't work - I had to install the SP1 version AND VC++2008. The author said in a comment on its website that it was a mistake on its side, and not mine. He is currently recompiling the DLLs to be statically linked. Thank you to all of those who helped me :)

    0 讨论(0)
  • 2020-12-10 06:39

    Try the latest version of OpenSSL.NET (0.4.1) which should now include prebuilt libeay32.dll and ssleay32.dll binaries that link to the CRT statically. Alternatively, you can build these libraries yourself or use an 'official' build from openssl.org.

    0 讨论(0)
  • 2020-12-10 06:41

    Your problem is related with this question:

    DllNotFoundException, but DLL is there

    Verify if all depencencies are in same folder of your application or are registred.

    0 讨论(0)
  • 2020-12-10 06:43

    For anyone else out there still experiencing this issue (and have verified that the necessary prerequisites exist in their correct locations:

    Check the OpenSSL.NET installation documentation and ensure its prerequisites are installed. In my case, a user was missing the Microsoft Visual C++ 2010 Redistributable Package (x86) dependency which is called out in the OpenSSL.NET documentation.

    0 讨论(0)
  • 2020-12-10 06:45

    Without looking at your code exactly, I get that error when I:

    • do not have the dlls in the path of the executable (not where your sln resides, but where the .exe is made, typically in bin/debug or bin/x86/debug or whatever).
    • do not have the proper signature of the calling function (ie, I left out an integer parameter, the return types don't match, etc).
    • am not marshalling the types properly (ie, BOOL is marshalled as a bool, while bool is marshalled as a unsigned single byte integer, etc)-- while this last one may not cause the exception, it can cause decidedly funky behavior.
    • am on a 64 bit platform and am calling a 32 bit dll. The pointer sizes will be all different, and the dll will probably just crash and cause that exception.

    EDIT: When all else fails, try dependency walker, because it sounds like your dlls are calling other dlls that aren't in your path or in the directory of the executable.

    0 讨论(0)
  • 2020-12-10 06:49

    You're probably missing the VC++ redistributables. I'm assuming OpenSSL.NET is x86 only, so you can grab the VS2008 version x86 redistributable if they're release builds.

    Otherwise, if they're debug builds (you'll see Microsoft.VC90.DebugCRT in EventViewer or the sxstrace logs) then you'll need to either:

    • Rebuild them as release
    • Install or copy the debug redistributables from another machine
    • Install Visual C++ into Visual Studio (or, probably, Visual C++ Express)
    0 讨论(0)
提交回复
热议问题