问题
We have started getting the following error on some of our payment applications:
Unexpected Error from method PurchasePermitObject: MakePayment
The underlying connection was closed: An unexpected error occurred on a receive.Unable to find an entry point named 'EnumerateSecurityPackagesW' in DLL 'security.dll'.
The error happens sporadically with no rhyme or reason. On researching this issue I have discovered there is an issue with using a dll named security.dll
https://connect.microsoft.com/VisualStudio/feedback/details/104453/existence-of-a-dll-named-security-dll-in-bin-directory-causes-web-service-request-to-fail-with-401-access-denied
Now the applications uses a security dll but it is prefixed e.g. ABCsecurity.dll and I would have thought this would have prevented this issue as it is the solution proffered by MS and other blogs etc.
Any ideas would be appeciated as this is causing, is the possibility of renaming it completely away from anything ending in security.dll?
回答1:
The error message says it is using "security.dll" so it has nothing to do with "ABCsecurity.dll". Search the hard drive of that machine for files named "security.dll"
This kind of problem is likely to be caused by Windows searching the process' current working directory for DLLs if it cannot find the DLL in the directory that contains the EXE. It's been a security hazard and Microsoft has designed some counter-measures against it. The most relevant MSDN page is here. You cannot do anything about the LoadLibrary() call, that's baked inside the framework code. The manifest is a bit painful, the easiest one is the SafeDllSearchMode registry key. That ensures that the security.dll file in the c:\windows\system32 directory is always found first, before a random copy in the working directory.
来源:https://stackoverflow.com/questions/10976622/security-dll-issue-with-net-project