SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
ASP.NET, VB.NET, Microsoft .NET Framework, Microsoft Visual Studio, Windows Forms, Controls and more Tutorials and Articles for Programmers


Failed to initialize the AppDomain

I set up a virtual directory for an ASP.NET 2.0 application.

I pointed the folder where the source files are located as the Local Path of the virtual directory. I set the ASP.NET version property of the virtual directory to 2.0.50727 on the Properties screen of the directory which I have opened by using the IIS management console.

Then when I wanted to browse the application by calling a web page, I got the following error message.

Server-Application-Unavailable

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

As written in the message I checked the application event log of the web server where this application is running on for more detailed information about the error. I found the following data about the error in the application log.

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1073
Date: 16.05.2006
Time: 13:30:34
User: N/A
Computer: ERALPERWS
Description:
Failed to initialize the AppDomain:/LM/W3SVC/1/Root/TicketSite

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)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Since the "Access is denied" exception is taken, I opened the root folder of the virtual site and right click to open the context menu. Then select Properties from the menu and navigate to Security tab. I noticed that the ASP.NET Machine Account is not listed in the Group or user names area, add the ASP.NET user of the web server with read permissions.

After the read permissions are given to ASPNET user of the server, I can browse the site successfully.

Related Microsoft.NET Articles & .NET Tutorials
Failed to start monitoring file changes


Visual Studio


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.