3つのASP.netMVCWebアプリケーションを作成しましたが、すべてISPとの共有ホスティングサーバーに展開されています。
3つのアプリケーションはすべて、構成と設定が非常に似ています。1番目のアプリケーションは、2番目および3番目とは異なるサーバーにデプロイされます。最初のアプリケーションではエラーは発生しません。
2番目と3番目のアプリケーションは、次のSecurityExceptionを いくらか吐き出します:ランダムに:
例外テキスト:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +99
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
web.configをデプロイまたは編集した後、最初にページにアクセスしたときに上記のエラーが発生します。ただし、後続のページのリロードでは取得できません。2つのWebサイトは、その日の残りの時間は再び正常になりますが、翌朝、同じエラーが再び発生します。
web.configを編集した後、エラーが一貫して表示されます。これは、再コンパイルを強制していると想定していますか?
助けてください。何が問題なのかわかりません。IISのセキュリティ設定に関連しているようです。エラーが発生しない最初のWebアプリが完全に異なるサーバー上にあることを除いて、3つのWebアプリはすべて非常によく似た方法でセットアップおよびデプロイされます。