【发布时间】:2013-07-12 15:03:18
【问题描述】:
我删除并重新创建了 ASP.Net 站点的子域。然后我上传了文件,但是当我打开浏览器时,我得到一个安全异常,指出我必须修改应用程序的配置文件以授予信任。遗憾的是,错误消息没有说明导致问题的文件、存在问题的信任或我能看到的任何内容。
这是我看到的:
Server Error in '/' Application.
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.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
[No relevant source lines]
Source File: App_Web_iqeawexe.0.cs Line: 0
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
System.Security.CodeAccessPermission.Demand() +46
System.Reflection.RuntimeAssembly.VerifyCodeBaseDiscovery(String codeBase) +118
System.Reflection.RuntimeAssembly.GetName(Boolean copiedName) +69
System.Reflection.Assembly.GetName() +12
DevExpress.Web.ASPxClasses.Internal.HttpUtils.<get_DXValidatorType>b__0(Assembly i) +9
System.Linq.WhereArrayIterator`1.MoveNext() +55
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +4216052
DevExpress.Web.ASPxClasses.Internal.HttpUtils.get_DXValidatorType() +120
DevExpress.Web.ASPxClasses.Internal.HttpUtils.GetValueFromRequest(HttpRequest request, String key, Boolean skipValidation) +25
DevExpress.Web.ASPxClasses.Internal.HttpUtils.GetValueFromRequest(String key, Boolean skipValidation) +60
DevExpress.Web.ASPxClasses.Internal.MvcUtils.get_CallbackName() +79
DevExpress.Web.ASPxClasses.Internal.RenderUtils.IsAnyCallback(Page page) +51
DevExpress.Web.ASPxClasses.Internal.ResourceRegistrator.EnsureResourcesSynchronized(Page page) +55
DevExpress.Web.ASPxClasses.Internal.ResourceRegistrator.RegisterResource(Page page, ResourceData resource, Boolean useStandardRegistration) +19
DevExpress.Web.ASPxClasses.ASPxWebControl.RegisterHoverIncludeScripts() +84
DevExpress.Web.ASPxClasses.ASPxWebControl.RegisterClientIncludeScripts() +72
DevExpress.Web.ASPxClasses.ASPxWebControl.OnPreRender(EventArgs e) +96
DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.OnPreRender(EventArgs e) +32
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8431
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
System.Web.UI.Page.ProcessRequest() +78
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in App_Web_iqeawexe.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
想法?
【问题讨论】:
-
您是否以中等信任度运行?
-
我认为我是中等信任度。我在一个共享的托管环境中,所以它是什么产生的。我想我记得以前与网络托管服务提供商的通信中确实如此。有趣的是,该网站过去运行良好。上周计算机崩溃了,他们托管了我的帐户。他们重建了东西,但使用了旧版本的备份,无论如何。我决定最简单的方法是删除子域,重新创建子域,然后再次上传文件。但是,该操作仍然产生相同的错误消息。
-
我知道在共享托管环境中不允许我“完全信任”,并且该站点运行良好。当 Web 主机提供商重建机器时,他们可能会更改信任级别并使其比 ASP.Net / DevExpress 喜欢的更严格。我不知道哪个组件实际上导致了故障。我不清楚堆栈跟踪。
-
我会联系网络托管公司并听取他们的意见。
-
请注意,Medium Trust 不是很安全,已被 Microsoft 弃用。向他们发送指向 stackoverflow.com/a/17218344/34397(由 ASP.Net 安全团队的一位开发人员提供)和 support.microsoft.com/kb/2698981 的链接,并要求他们切换到更安全的隔离。
标签: asp.net security file-permissions trust