我已經寫了3個ASP.net MVC Web應用程序,並且都與我的ISP一起部署在共享主機服務器上。log4net在ASP.Net MVC Web應用程序中拋出安全異常
所有3個應用程序在配置和設置上都非常相似。第一個應用程序部署到第二個和第三個不同的服務器上。第一次申請沒有給我任何錯誤。
的第二和第三應用程序吐出以下拋出:SecurityException有些:隨機:
alt text http://i46.tinypic.com/24p9pac.jpg
異常文本:
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後第一次點擊頁面時出現上述錯誤。但是,在後續頁面重新加載時,我不明白。這兩個網站在今天的其餘時間將再次罰款,但第二天早上我再次得到同樣的錯誤。
在我編輯web.config後,錯誤確實出現,我假設它正在強制重新編譯?
請幫忙。我不確定問題是什麼。聽起來像它與IIS中的安全設置有關。所有3個Web應用程序都以非常相似的方式進行設置和部署,不同之處在於第一個不出現錯誤的Web應用程序位於完全不同的服務器上。
優秀小費將信任級別設置爲「中」,從而啓用本地計算機上的調試。謝謝! – Adventure 2013-06-05 19:44:35