Access is denied ... Could not load file or assembly 'PresentationFramework ...

Access is denied ... Could not load file or assembly 'PresentationFramework ...

Old forum URL:

raz0rf1sh posted on Sunday, February 21, 2010

I'm getting the following error ... I thought it might have something to do with MVC, but looks like it something CSLA references. Any idea how to get around this?

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

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.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

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.

Stack Trace:

[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]

[FileLoadException: Could not load file or assembly 'PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Access is denied.]
   Csla.ApplicationContext.set_User(IPrincipal value) +0
   Startup.Carthage.Security.BusinessPrincipal.Logout() in C:\Users\matt.ruma\Documents\Code\StartupSoftwareSolutions\Carthage\Source\Logic\Security\BusinessPrincipal.cs:41
   Startup.Carthage.WebMvc.MvcApplication.Application_AcquireRequestState(Object sender, EventArgs e) in C:\Users\matt.ruma\Documents\Code\StartupSoftwareSolutions\Carthage\Source\WebMvc\Global.asax.cs:71
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

RockfordLhotka replied on Sunday, February 21, 2010

I haven't quite seen that before. The assembly in question is a WPF assembly, referenced by CSLA. It would load as CSLA determines whether you are running in WPF - so really just one method is loaded out of that assembly, so it can return a null to indicate WPF isn't active.

Is your app running with FullTrust? And on a server where .NET 3.5 is installed?

raz0rf1sh replied on Monday, February 22, 2010

Hi Rocky,

Thanks for the quick response!

Yes ... it's running in IIS 7 with the trust at Full (Internal) and the .NET Framework 3.5 SP1 is installed. It only happens with my CSLA projects. I think I figured it out ... I am using the PLESK Panel for managing the websites on the server. I noticed that it had setup it's only application pool using a different account, one setup by the software. I switch the application/website to run in the DefaultPool under the Network Service account and everything seems to be working now.

Does this make sense? 

RockfordLhotka replied on Monday, February 22, 2010

If it solved the problem then it makes sense Big Smile


Copyright (c) Marimer LLC