asp.net - 1and1 安全异常问题

标签 asp.net visual-studio razor

我已经从 1and1 购买了共享 Windows 托管计划。上传默认的 Visual Studio“网页”站点后,我在 1and1 上收到以下错误。考虑到这是 Microsoft 的默认模板,至少可以说我感到非常惊讶。 如果有人能够提供任何帮助,我将不胜感激。
非常感谢。

'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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error: 



Line 3:      <head>
Line 4:          <meta charset="utf-8" />
Line 5:          <title>@Page.Title - My ASP.NET Web Page</title>
Line 6:          <link href="~/Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
Line 7:          <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />


 Source File:  e:\kunden\homepages\41\d516833426\www\_SiteLayout.cshtml    Line:  5 

Stack Trace: 



[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, 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.Web.HttpContext.System.IServiceProvider.GetService(Type service) +54
   System.Web.HttpContextWrapper.GetService(Type serviceType) +11
   System.Web.WebPages.UrlRewriterHelper.IsUrlRewriterTurnedOn(HttpContextBase httpContext) +108
   System.Web.WebPages.UrlRewriterHelper.WasRequestRewritten(HttpContextBase httpContext) +13
   System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +138
   System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +103
   System.Web.WebPages.UrlUtil.GenerateClientUrl(HttpContextBase httpContext, String basePath, String path, Object[] pathParts) +144
   System.Web.WebPages.WebPageExecutingBase.Href(String path, Object[] pathParts) +44
   ASP._Page__SiteLayout_cshtml.Execute() in e:\kunden\homepages\41\d516833426\www\_SiteLayout.cshtml:5
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
   System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +233
   System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +80
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +63
   System.Web.WebPages.WebPageBase.PopContext() +267
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +98
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +171
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContext context) +66
   System.Web.WebPages.WebPageHttpHandler.ProcessRequest(HttpContext context) +5
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055'

最佳答案

您的托管商(1 和 1)强制网站以中等信任度运行。 Medium Trust 已过时,ASP.NET 以后不再支持它。参见 https://stackoverflow.com/a/17218344/59641http://support.microsoft.com/kb/2698981获取更多信息。

您可以尝试说服 1and1 以完全信任的方式运行您的网站。否则,您应该考虑转移到允许完全信任的新主机。

关于asp.net - 1and1 安全异常问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22150465/

相关文章:

c# - 在 ASP.NET 中删除记录后防止后退按钮或显示错误

ios - 对于 Xamarin.iOS : Community, 专业版或企业版,我需要哪个 Visual Studio for mac

c# - 在 Razor 中,如何根据元素的属性检查 ViewBag IEnumerable 对象中是否存在对象?

c# - 是否可以从 Visual Studio 中复制代码并将格式化的代码粘贴到 OneNote 中?

visual-studio - TeamCity Visual Studio 插件

asp.net-mvc-3 - 如何使用 Html.ValidationSummary 仅显示一条错误消息?

javascript - 从所有选中的复选框中获取 ID

asp.net - Windows 身份验证和网络服务帐户作为 db_owner

javascript - 从 Jquery 表单发布数据

asp.net - 显示/隐藏列表的一部分