ASP.Net Deployment Error: Could not load file or assembly - asp.net

I have a asp.net website in .Net 4.0 that runs fine in our staging environment. When we moved it into production we are getting following error
Server Error in '/mysite' Application.
Could not load file or assembly 'SupportSite.UI' or one of its dependencies. Access is denied.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'SupportSite.UI' or one of its dependencies. Access is denied.
I assume it is a security issue. It is deployed using IIS WAS settings.
What are the users for whom I need to grant permission (and on what all folders)?
What is the user corresponding to aspnet_wp.exe or w3wp.exe?
REFERENCES
Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues
Could not load file or assembly 'Telerik.Web.UI' or one of its dependencies
ApplicationPoolIdentity permissions on Temporary Asp.Net files
could not load file or assembly, Tried all solution on net

You need to grant read permission for the lib folder to IIS_IUSRS account.

I asume your using IIS 7.5..
You have two choices: Adding your library to GAC, or give read permissions to the application pool account.
See this about app pool account permissions:
http://www.iis.net/learn/manage/configuring-security/application-pool-identities

Related

Access is denied debugging ASP.NET Core app referencing Sqlite running in IIS

The ASP.NET Core 2.2 project references Microsoft.EntityFrameworkCore.Sqlite (2.2.3) as a PackageReference.
Debugging the app in IIS Express works fine, because of the elevated user process.
Problem: Debugging the app in IIS throws an error
Unable to load DLL 'e_sqlite3' or one of its dependencies: Access is denied
How can I debug the app in IIS without laborious publishing steps?
My analysis so far: while e_sqlite3.dll is found and loaded successfully in the folder %userprofile%\.nuget\packages\sqlitepclraw.lib.e_sqlite3.v110_xp\1.1.12\runtimes\win-x64\native\e_sqlite3.dll it has only Read but no Read & Execute permission set.
The missing Execute permissions seems to be the culprit.
It works if I give Users group or ApplicationPoolIdentity also Read & Execute.
Why is the global NuGet packages folder missing Read & Execute? Is this only a problem of the unmanaged code dll's?
Stack Trace
System.DllNotFoundException: Unable to load DLL 'e_sqlite3' or one of its dependencies: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)

Azure Deployment: Could not load file or assembly or one of its dependencies. The process cannot access the file because it is being used

I deployed my multi-tier application to azure. It was working perfectly, but now when I try to deploying it, it shows an error saying:
Could not load file or assembly 'MySomething.dll' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
I checked other answers, but all of them dealing with IIS. Azure Web Apps IIS cannot be accessed directly. How can I resolve this?
As usual, this issue happened because of caching. Removing the bin/obj directories alongside the IIS Express cache folder fixed the issue.

Security Exception with SelectPdf .net

I have unloaded the version free Community Edition from
http://selectpdf.com/html-to-pdf/demo/
Because I wanted to use the example that turned a page html into pdf.
In visual studio I have succeeded in using the file asp.net but when I put it online I receive this error:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.
I have loaded the files on three different servers.
Azure, Aruba and Godaddy, but do I always receive the same error, as I can resolve?
http://pdf.cyberkings.fr/html-to-pdf-converter.aspx
http://www.numero-telefono.it/html-to-pdf-converter.aspx
Thanks
Conversion failure. Could not find 'Select.Html.dep'.
Description: An unhandled exception occurred during the execution of the current web request
When installing Select.HtmlToPdf from NuGET, the installation copies the dependancy file Select.Html.dep to the bin. When you build, a copy gets placed in the /bin beside Select.HtmlToPdf.dll.
However, when deploying your application, the dependency file does not get copied automatically.
You need to copy Select.Html.dep manually.
See the SelectPdf Html To Pdf Converter for .NET deployment documentation.

Deploy ASP MVC in virtual directory

I have existing silverlight app which works as IIS application. And i need to deploy ASP MVC app as a part of this (don't ask me why) in virtual directory, not like new IIS application.
I use IIS 6.
I create new virtual directory in existing iis application and use path to ASP project folder as physical path of this virtual directory. But i get error
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: An error occurred loading a configuration file: Failed to
start monitoring changes to 'C:\Users\Alina\Desktop\MVCApp' because
access is denied.
Source Error:
[No relevant source lines]
Is it possible to deploy ASP MVC application in virtual directory?
How to do this right?
Yeah, that should be possible. I'm guessing whatever service account your deployment process is running as doesn't have permission to write to C:\Users\Alina\Desktop\MVCApp.
To prove that out, you could modify permissions on that folder to allow 'Everyone' write access. If that works, figure out what account your process is running as, and grant that read/write/whatever, and remove the 'Everyone' access.
That should get your deployment situation fixed. I can't speak to how the two apps will run side by side. I'd need more info.

Run time error in ASP.Net 1.1

I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'Interop.MSDASC'.
Source Error:
Line 196:
Line 197:
Line 198:
Line 199:
Line 200:
Source File: c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 198
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Interop.MSDASC' could not be loaded.
Line 198 of the standard machine.Config contains the line:
<add assembly="*"/>
which I assume is loading all assemblies from your local bin directory. It seems this directory contains an assembly Interop.MSDASC, and that IIS is unable to load this assembly because of an "Access Denied" error.
Some things to check:
does the account under which your web app is running (by default the Network Service account) have permission to access this file.
does your web app really need this assembly? AFAIK tt's for the Microsoft Data Link API, which allows the app to prompt the user for OLEDB connection information - I don't see why you'd use this in a web app.
Two thoughts...
Is the Interop.MSDASC dll in your web apps bin folder? Is the com components that this interop library uses installed on this machine?
Are there any funky things going on with permissions for these files?
Good luck, sounds like a nasty one.

Resources