2008-10-06 58 views
0

我試圖在中等信任級別環境中安裝Subtext(主持人:Crystaltech)和我收到以下錯誤(見下文)。我能夠做管理設置,但是當它試圖去實際使用的博客時,繁榮。潛臺詞安裝給人錯誤的中等信任級別

我知道我可以「升級」的環境到完全信任的水平,但我想知道爲什麼錯誤正在發生,那後果移動到完全信任我這樣做了。

要就這個問題展開;什麼是「信任級別」?

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.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 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.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal(String virtualPath, IPrincipal user, String verb) +47
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.GetHandlerForUrl(String url) +66
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.ProcessHandlerTypePage(HttpHandler item, HttpContext context) +143
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String path) +340
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161

回答

1

我不認爲有另一種方式來解決比移動到完全信任或刪除調用CheckUrlAccessForPrincipal()和重新編譯其他錯誤。

但是從外觀上看,這個特殊問題已經在subtext SVN(修訂版3290)中得到糾正。他們還爲subtext 2.0.1添加了一個新的構建任務,該任務應包含修復程序。我想這將在準備就緒後發佈。

1

信任水平真的只是指點一下的security.config文件。該dafault信任水平在C中定義:\ WINDOWS \ Microsoft.NET \框架\ V2.0.50727 \ CONFIG \ web.config文件, 「中」 信任指向web_mediumtrust.config。

至於例外情況,使用反射器來查看System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal()會發現該方法是由[SecurityPermission(SecurityAction.Demand,Unrestricted = true)]進行歸因的,這意味着它需要一個不受限制的安全權限,它沒有在中等信任下運行。從csgero

+0

我會研究,謝謝。 – Craig 2008-10-06 16:53:04