locked
Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied. RRS feed

  • Question

  • User1604300003 posted

    I have instances of VS2005 SP1 and VS2008 SP1 recently installed on my new laptop. I'm in the process of moving applications and dev software from my old machine (lease is up) to the new one. I have two web applications, both using Framework 2.0, that I've loaded and built. Both web apps (one developed in 2005, the other in 2008, but both Framework 2.0) throw a "Server Application Unavailable" error when attempting to render in the IE7  browser. The Application event log shows:

    Failed to initialize the AppDomain:/LM/w3svc/1/ROOT/CIRTWFE

    Exception: System.IO.FileLoadException

    Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.

    StackTrace: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)

    The System.Web file is in the \windows\assembly folder. The \windows\microsoft.net\framework\v2.0.50727 folder has the ASPNET worker processor account with the proper permissions. And yet I continue to get this error. Any thoughts on what I am missing?

    Tuesday, October 27, 2009 3:51 PM

Answers

  • User-952121411 posted

    Since it worked on the dev server and not on IIS, we definently know this is isolated to an IIS configuration issue specifically in regards to the NETWORK SERVICE or ASPNET user permissions. One of the folders somewhere is still missing access which is odd.  Did you make sure that you applied the proper permissions to both the 'wwwroot' folder and on the actual IIS virtual directory you are using to run your site?

    Read this from the following link:  http://msdn.microsoft.com/en-us/library/ms998320.aspx

    File Access

    The Network Service account has Read and Execute permissions on the IIS server root folder by default. The IIS server root folder is named Wwwroot. This means that an ASP.NET application deployed inside the root folder already has Read and Execute permissions to its application folders. However, if your ASP.NET application needs to use files or folders in other locations, you must specifically enable access.

    Here is another link where someone was stuck as well:

    http://www.issociate.de/board/post/236012/how_do_i_fix_this_error_in_asp_2.0.html

    Lastly, the IIS forum may have some insight as well as to pinpointing which directory you are missing the proper permissions.  That NETWORK SERVICE (Windows Server) and ASPNET (Windows) accounts need permissions on more than just the ASPNET Framework folder you mentioned prior.  Here is a link to the IIS forum as well:

    http://forums.iis.net/

     IMO, this was one of the best things that Microsoft incorporated the integrated Development Server into VS.NET 2005+.  It was always a real pain getting IIS configured properly for all of the projects on the development machine.  I almost never set my projects up on IIS on my development machine now, and rather use the development server in VS.NET.  I only have to set up IIS on either my test or productions servers, which are stable and do not have issues like this.  Might be a good time to switch over to the dev server to ease configuration if you can.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 29, 2009 11:24 AM

All replies

  • User-952121411 posted

    1st, take a look to the following link with a similar exception caused by the 'NETWORK SERVICE' account permissions:

    http://forums.asp.net/p/1236427/2288023.aspx#2288023

    Also one thing to check; are you running your web applications through the VS.NET Development Server or IIS?  I have seen an error similarly displayed when the site is ran through IIS and the website has not been configured to use ASP.NET 2.0, but rather is using the default of ASP.NET 1.1. 

    Tuesday, October 27, 2009 3:58 PM
  • User1604300003 posted

    Iam running the sites in IIS on my local machine. Both are configured for ASP.NET 2.0.50727. 

    Tuesday, October 27, 2009 4:04 PM
  • User-952121411 posted

    Did you work through the solutions in the link I provided?  It seems the error you are getting is quite common, and I found several links diagnosing the problem.

    Also, try running from the development server (right-click project, goto properties, select the 'Web' tab' and choose the radio button for 'Use Visual Studio Development Server') just to see if it works, or if you get the same issue. 

    Tuesday, October 27, 2009 4:19 PM
  • User1604300003 posted

    Pls forgive my delayed reply. I had to get some production work done and now am back. I have some time today to devote to this.

    I ran the app using the dev server as suggested. It does work, though it failed to connect to the newly constituted database, but that's another issue. Bottom line is that the app started and code was executed.

    I went thru the solutions noted, but nothing worked. Same problem each time. I've compared folder security between my old laptop (all web apps work) and my new laptop (no web apps work) and cannot find anything. The ASPNET & NETWORK SERVICE accts are set up on \WINDOWS\Microsoft.NET\Framework\v2.0.50727 folders.  I also verified that the System.Web.dll file is in the \WINDOWS\assembly folder with the 2.0.0.0 version and same key.

    All my newly loaded/configured web apps (all .NET 2.0) throw the same error. I'm truely stumped here.

    Thursday, October 29, 2009 10:53 AM
  • User-952121411 posted

    Since it worked on the dev server and not on IIS, we definently know this is isolated to an IIS configuration issue specifically in regards to the NETWORK SERVICE or ASPNET user permissions. One of the folders somewhere is still missing access which is odd.  Did you make sure that you applied the proper permissions to both the 'wwwroot' folder and on the actual IIS virtual directory you are using to run your site?

    Read this from the following link:  http://msdn.microsoft.com/en-us/library/ms998320.aspx

    File Access

    The Network Service account has Read and Execute permissions on the IIS server root folder by default. The IIS server root folder is named Wwwroot. This means that an ASP.NET application deployed inside the root folder already has Read and Execute permissions to its application folders. However, if your ASP.NET application needs to use files or folders in other locations, you must specifically enable access.

    Here is another link where someone was stuck as well:

    http://www.issociate.de/board/post/236012/how_do_i_fix_this_error_in_asp_2.0.html

    Lastly, the IIS forum may have some insight as well as to pinpointing which directory you are missing the proper permissions.  That NETWORK SERVICE (Windows Server) and ASPNET (Windows) accounts need permissions on more than just the ASPNET Framework folder you mentioned prior.  Here is a link to the IIS forum as well:

    http://forums.iis.net/

     IMO, this was one of the best things that Microsoft incorporated the integrated Development Server into VS.NET 2005+.  It was always a real pain getting IIS configured properly for all of the projects on the development machine.  I almost never set my projects up on IIS on my development machine now, and rather use the development server in VS.NET.  I only have to set up IIS on either my test or productions servers, which are stable and do not have issues like this.  Might be a good time to switch over to the dev server to ease configuration if you can.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 29, 2009 11:24 AM
  • User372518037 posted

    Check out below given link, will be helpful

     

    http://www.developersword.com/ShowMessages.aspx?ThreadID=114

    Embarassed 

    Saturday, October 31, 2009 8:18 AM
  • User1604300003 posted

    First let me apologize for not replying to the outcome of your suggestions sooner. 

    The problem was not related to .NET, IIS or VS. My newly issued laptop was not keeping up with patches, though it was automatically programmed to do so. Once the patches were up to date my .NET problem resolved itself. All my web apps are working as designed.

    Thank you again for all the suggestions. I certainly learned a lot about .NET in the process. 

    Tuesday, January 19, 2010 10:27 AM