I have found plenty of information out there about this error: 'ERROR: Could not load file or assembly '*.dll' or one of its dependencies. Access is denied.’
But i haven't found answer specific to my scenario.
My site is deploy on 6 different production servers, only on one server i am facing this issue. The issue is random, but after it happens once, it continues until the site is recompile by done a small modification in web.config file(i know trick, after modification in web.config recompile the web application) and site on that server start working.
Yesterday, issue was reproducing after one month period of working.
We can't afford this issue on production.
Issue detail:
Server Error in '/' Application. ____________________________________ Could not load file or assembly 'MainCore.DbImpl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MainCore.DbImpl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MainCore.DbImpl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'MainCore.DbImpl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.] ...DbImpl.Event.TTCEventController.GetEventFields(Int32 eventId) +0 WebSuite.SportChannel.ModelImpl.TTCModelController.AddEventFieldList(XmlElement eventNode, ITTCEventController ctrl, Int32 eventId, PlayerType stupidType) in ...root\SportChannel\ModelImpl\Ttc\TTCModelController.cs:171 ...ModelImpl.TTCModelController.GetLatestFourTourSchedulesXml() in ...root\SportChannel\ModelImpl\Ttc\TTCModelController.cs:283 ...WebRoot.UserControls.HeadlinesTab.Page_Load(Object sender, EventArgs e) +491 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.OnLoad(EventArgs e) +132 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Control.LoadRecursive() +191 System.Web.UI.Control.LoadRecursive() +191 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
____________________________________Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420
There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.
The solution to this problem is to enable 32 bit Applications in Application Pool of IIS Server. Following are the three simple steps to enable 32 bit Applications in Application Pool of IIS Server. 1. Open Internet Information Services (IIS) Manager and click on Applications Pool from the Left window as shown below.
If you get an 'Access Denied'.. try checking the permissions on the Temp ASP.NET folder. If you get 'Invalid Argument' try cleaning the temp asp.net folder and restarting the web site.
“An attempt was made to load a program with an incorrect format.” That means that the assembly, which was to be loaded, was in an unexpected format. The format, in this case, refers most likely to the 64-bit build of an application being deployed to IIS, which is being run in 32-bits.
For my scenario, I found that there was a identity node in the web.config file.
<identity impersonate="true" userName="blah" password="blah">
When I removed the userName and password parameters from node, it started working.
Another option might be that you need to make sure that the specified userName has access to work with those "Temporary ASP.NET Files" folders found in the various C:\Windows\Microsoft.NET\Framework{version} folders.
Hoping this helps someone else out!
Had the same issue, fixed with setting the parameter "Enable 32-bit applications" to "true" (in advanced settings of iis application pool).
My solution is as follows:
I didn't find a root folder under C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
.
Google told me that it might be a permission issue against current user, then I found I have a current Identity: IIS APPPOOL
in the malfunctioning server where the rest of the server has Current Identity: NT AUTHORITY\NETWORK SERVICE
.
Then I changed Current Identity from IIS APPPOOL
to NT AUTHORITY\NETWORK SERVICE
.
From here, I found that resetting the web app rebuilds the temporary ASP.NET cache, solving the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With