運行.NET Web應用程序時,我收到了一個EventLog未知的錯誤。無法加載文件或程序集「System.Web」或其某個依賴項。訪問被拒絕
該應用程序基本上讀取數據庫,然後從磁盤讀取文件大小,然後寫回到數據庫。
我已經得到了應用並用我的工作站(IISExpress)上沒有問題,我們的其他服務器(Windows 2008在IIS7)
但我對我們的IIS6 2003 R2服務器上運行它,我得到運行一些奇怪的行爲。在IIS應用程序啓動和報告沒有錯,但是當我嘗試訪問的網頁,我收到了「服務器應用程序不可用」,並在服務器上的事件日誌給了我這個轉儲:
Event Type: Error
Event Source: ASP.NET 4.0.30319.0
Event Category: None
Event ID: 1325
Date: 24.05.2011
Time: 13:29:11
User: N/A
Description:
Failed to initialize the AppDomain:/LM/W3SVC/1309226359/Root
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
StackTrace: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.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.InternalCreateInstanceWithNoSecurity(String assemblyName, String typeName)
at System.AppDomain.InternalCreateInstanceWithNoSecurity(String assemblyName, String typeName)
at System.Activator.CreateInstance(AppDomain domain, 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)
該應用程序將繼續在IIS中運行。這個IIS也承載了一大堆其他網站沒有任何問題。是的,該應用程序設置爲在.NET 4上運行,而服務器託管其他.NET 4應用程序也沒有任何問題。
從我可以告訴,它不能加載System.Web程序集,但我不知道怎麼說甚至有可能...
下面是應用程序的Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<globalization culture="nb-NO"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<customErrors mode="Off"></customErrors>
<xhtmlConformance mode="Strict"/>
<httpRuntime requestValidationMode="2.0"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
</system.webServer>
</configuration>