Failed to initialize the AppDomain:/LM/W3SVC/1/Root/WebSite1

I have installed IIS and registered asp .net worker process on many machines now. But today while setting up and my new laptop I recieved two weird errors. The first one was

Event Source: ASP.NET 2.0.50727.0
Failed to initialize the AppDomain:/LM/W3SVC/1/Root/WebSite1

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.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)

Followed by two more errors

Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005 Access is denied.

and

aspnet_wp.exe (PID: 3720) stopped unexpectedly.

Upon some investigations I found out that this error occurs if you do not restart the machine after installing IIS. What I did wrong was I installed IIS and immediately after that installed Visual Studio which must have registered the asp .net 2.0 on IIS. To overcome the problem I took the following steps

  1. Uninstalled the IIS
  2. Restarted the machine
  3. Installed the IIS
  4. Restarted the machine
  5. Re-register the asp.net : using aspnet_regiis.exe -i

While this solved this problem, I then started to encounter another weird error, which I could not believe. All I was seein g when I used to run an asp.net application locally was Server not available error.

When I checked the system event logs I saw an error entry

Event Type: Error
Event Source: W3SVC
Event Category: None
Event ID: 115
Date: 24/09/2007
Time: 5:44:08 PM
User: N/A
Computer: BITG022-NB
Description:
The service could not bind instance 1. The data is the error code.
For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

This error is caused and will occur if some application is already running and utilising Port 80,which is the default Http port. In my case I was running skype; In skype there is an option where you can use. Check the image below for reference.

skype

16 Responses to “Failed to initialize the AppDomain:/LM/W3SVC/1/Root/WebSite1”

  1. Fernando Arámburu Says:

    Did you try by just adding ASPNET user account default permission into your website folder? Sometimes, when you use Visual Studio folders on “my documents”, VS inherits security permissions from your “my documents” folder and then failed when trying to load app domain….

  2. Dan Says:

    Thank you Fernando, I ran into this issue and sure enough the NTFS permissions on the virtual directory folder were all messed up for some reason. I never would have thought to look at that without your suggestion.

  3. debdeep chaudhuri Says:

    i run into the same problem and i did what Fernando said, and solve the problem.
    Thanks to u.

  4. gaffertape Says:

    Adding the Network Service account with read/write right access to the website root folder fixed it for me. I had already tried re registering .net 2.0 & restarting the box, so maybe they help too 🙂

  5. Dave Says:

    I managed to skip a few steps there. ASPNET_REGIIS can usually fix the problem without need for restart.

    Minimum Permissions on web directory:
    IUSR_ Read
    ASPNET_USER Read & Execute

  6. Dave Says:

    — No HTML Encoding on the above post
    Should say IUSR_<Machine name> Read

  7. Shakeeb Says:

    I had similar problem and fixed it by only re-registering ASP.NET using aspnet_regiis.exe -i

  8. Ramkumar Says:

    I got the same issue and i did what Fernando said, and solve the problem.
    Thanks you.

  9. Joshua Says:

    For me, this started after it had been working.
    But I had done something that affected permissions.

    adding IIS_WPG and IUSR_DADDOO (my domain is DADDOO), to the directory solved it. Blasted permissions!

  10. Gary Novak Says:

    This gave me enough information to figure it out. I had to copy the permissions from another ASP.NET site that I had that was working to get the permissions correct.

    Basically I needed to add permissions for ASP.NET, NETWORK SERVICES, IIS_WPG. Once I added the correct permissions, then things worked out.

    I am thinking that the upgarde to ASP.NET 3.5 SP1 may have reset some permissions.

  11. Mohamed Rashwan Says:

    Thank you Fernando.

  12. Steve Says:

    Thank you so much for this, my problem was also permissions to the virtual directory. I granted IIS_WPG, NETWORK SERVICE, IUSR_Computername, ASP.NET all Read/Write and now all is well.

  13. saika Says:

    Thank you Fernando. I searched and tried many other solutions. But your solution rocks! Thanks

  14. Jason Says:

    thought I would share this. This happened to me this morning. Lost half a day trying to figure it out. Turns out, it was because I shared the folder with the Services were deployed to.

  15. Muscle King Pro Says:

    Hi everyone, it’s my first pay a quick visit at this website, and post is genuinely fruitful in favor of me, keep up posting such posts.

  16. how to flirt with a woman Says:

    I do agree with all the ideas you have offered in your
    post. They’re really convincing and can certainly work. Nonetheless, the posts are very quick for starters. Could you please prolong them a bit from next time? Thank you for the post.


Leave a comment