.NET Webアプリケーションを実行しているときに、不明なEventLogエラーが発生します。
アプリは基本的にデータベースから読み取り、次にディスクから読み取ります(ファイルサイズを読み取り、データベースに書き戻します)。
ワークステーション(IISExpress)と他のサーバー(IIS7を搭載したWindows 2008)で問題なくアプリを起動して実行しています。
しかし、IIS6を搭載した2003 R2サーバーで実行すると、奇妙な動作が発生します。IISアプリが起動し、何も問題がないことを報告しますが、Webページにアクセスしようとすると、「サーバーアプリケーションが利用できません」というメッセージが表示され、サーバーのEventLogから次のダンプが返されます。
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で実行するように設定されており、サーバーは他の.NET4アプリも問題なくホストします。
私の知る限り、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>