-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DllNotFoundException: Unable to load DLL 'sni.dll': Access is denied. #7480
Comments
I'm having the same problem on Windows 7. Never happened before. |
/cc @schellap |
It looks like a pre-req issue. Can you confirm if you have the pre-reqs installed on Windows as described here? https://docs.microsoft.com/en-us/dotnet/articles/core/windows-prerequisites#net-core-dependencies Esp., the ucrt update. |
And this KB: For Windows 7 and Windows Server 2008 machines only: |
I am on windows server 2012 r2 so I will skip the windows 7 and 2008 instructions |
I have these vc++ items KB2533623 looks like another windows 7 update that was published in 2011. My update history |
What is the ucrt update @schellap? |
@steveoh I think you have the necessary pre-reqs. I got misled by the win7 comment above. Can you guide me through how to publish your app from your repo -- what steps are you using? I did the following:
Is the above your flow? |
Yes basically. this issues explains it a bit more when I thought it was an IIS integration issue. |
Any updates here? |
None from me |
Had the same issue. Fixed it by assigning full control to %USERPROFILE%.nuget. You can also try to change the app pool identity in IIS to LocalSystem. |
Thanks @azisoft , I've just solved the issue following your second advice: change the app pool identity to LocalSystem |
This happen with me. https://docs.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities All my sites run with Application Pool Identity, with "Read" only permission to IISAppPool\APPLICATIONPOOLNAME to the site's folder. With .NET Core i'm having this problem with some sites, that could be solved by giving ONLY the folder's DLL the "Read and Execute" permission solve the problem. But it's not how should be, in my opinion, as "Execute" permission give a security flaw as someone could inject a code in that folder and execute remotely. Something is making the AppPoolIdentity need to execute the DLLs needed to access SQL Server. |
I am also receiving below error with .Net Core 3.1: An unhandled exception occurred while processing the request.
DllNotFoundException: Unable to load DLL 'sni.dll' or one of its dependencies: Access is denied. (0x80070005 (E_ACCESSDENIED))
Can anyone please guide? |
Change the app pool identity in IIS to LocalSystem did the trick for me, thank you @azisoft |
How about setting permissions for Which of these option is better? Setting |
@naveedahmed1 just give execute permission to user "IIS AppPool\NAMEOFTHEAPPLICATIONPOOL" instead of changing to LocalSystem. So if you have an application pool called "WebApp1", and a site in IIS pointed to the folder "E:\Inetpub\WebApps\WebApp1" using the application pool WebApp1, you just have to create a "Read/Execute" permission to \WebApp1 folder to the following user: "IIS AppPool\WebApp1" (search for Local Computer accounts instead of a domain, you have one), isn't searchable, just write this and should work. |
This works for me => Grant access to runtimes\win-arm64. |
Just to help and documentate this to everyone that could have a problem with permissions on DotNet Core. "Read & execute permissions should be granted by default" https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1 With that, we changed the procedures to host DotNet Core applications, changing every project to use Read And Execute instead of Read, and with that the sni.dll (and other DLL) should not be a problem. Personally i don't agree with this "default" as i told early; Execute permission could give security problems, and DotNet Framework seems to work fine with Read only, but i cannot argue with official documentation lol |
Steps to reproduce
Project Repository
dotnet publish -c Production
copy files to a windows 2012 r2 iis8.5 machine with the hosting bundle installed.
Expected behavior
I expect the application to work when published to IIS when using a sql client like it does when run on OSX.
Actual behavior
Environment data
dotnet --info
output:The text was updated successfully, but these errors were encountered: