IIS 7 and Above
Unable to load DLL access is denied (exception from HRESULT: 0x800700...
Last post Jan 13, 2014 04:41 AM by Terry Guo - MSFT
Jan 11, 2014 04:57 AM|MagsB|LINK
I'm consuming a 32-bit native DLL from a c# web service. Everything works fine locally in VS with IIS express. However when I deployed the site to a shared hosting provider (Server 2012 R2, IIS 7) the calls to the DLL (using platform invoke) generated an
Unable to load DLL 'dll_name.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I asked the hosting provider to make sure my process is running in 32-bit mode and they assured me it is.
Tech support also tried the following:
When this exception occurs, the exception.Message reads:
However, the exception.HRESULT value is 0x80131524 which it seems to be DLL not found. I'm not sure why there's a difference.
If I delete the DLL from the /bin folder, I get the following message:
Unable to load DLL 'dll_name.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I also tried the following:
1- Replaced dll_name.dll with another native DLL from my bin folder, I got the same access denied error
2- Replaced dll_name.dll with one of my windows DLLs (user32.dll), got the same access denied error
3- Replaced dll_name.dll (in DllImport) with server user32.dll, got the following error:
Unable to find an entry point named 'MyImportedFunction' in DLL 'user32.dll'.
4- Replaced dll_name.dll with one of the managed DLLs from my bin folder, got the following error: Unable to find an entry point named 'MyImportedFunction' in DLL 'GR_Core.dll'
Jan 13, 2014 04:41 AM|Terry Guo - MSFT|LINK
According to your exception message, I think is caused by the permission.
So, plese try to refer to the following solution:
1. Please try to add "EveryOne" account to allow access the dll file, and then give the EveryOne read permission, if have done it, please try to run your application.
2. If the previous method can work, the dll needs to have IIS_IUSRS - read, List folder contents & read-execute permissions.
Hope it helps.