使用在VS 2015中创建的ASP.NET MVC应用程序,我的Web主机所需的信任级别出现问题。
所以我从模板创建了一个“虚拟”应用程序(没有我自己的代码 - 只是默认创建的Home,About,Contact控制器等),并且web主机在中等信任级别运行。我在本地复制它,强制它在web.config中达到中等信任级别,并获得以下异常跟踪:
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm,PermissionSet被授予,PermissionSet被拒绝, RuntimeMethodHandleInternal rmh,SecurityAction动作,对象需求, IPermission permThatFailed)+165
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(对象 assemblyOrString,PermissionSet被授予,PermissionSet被拒绝, RuntimeMethodHandleInternal rmh,SecurityAction动作,对象需求, IPermission permThatFailed)+100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet中 授予,PermissionSet拒绝,PermissionSet要求, RuntimeMethodHandleInternal rmh,Object assemblyOrString, SecurityAction动作,Boolean throwException)+284
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs,PermissionSet授予,PermissionSet被拒绝,PermissionSet 需求,RuntimeMethodHandleInternal rmh,RuntimeAssembly asm, SecurityAction行动)+70
System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly, StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName,ObjectHandleOnStack type)+0
System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly, StackCrawlMark&安培; stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName)+70 System.RuntimeType.GetType(String typeName,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMark& stackMark)+40
System.Type.GetType(String typeName)+30
System.CodeDom.Compiler.CompilerInfo.get_IsCodeDomProviderTypeValid() +10 System.Web.Compilation.CompilationUtil.GetRecompilationHash(CompilationSection ps)+2485
System.Web.Configuration.CompilationSection.get_RecompilationHash() +92 System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDateInternal(Int64 cachedHash)+498
System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate(Int64的 cachedHash)+53
System.Web.Compilation.BuildManager.ExecutePreAppStart()+133
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel,Exception appDomainCreationException)+674
对于MVC应用程序,我是否可以在中等信任级别运行,抱怨的消息是什么?
Web主机表示如果需要可以将其增加到完全信任,但我想在请求之前确保实际需要它。
功能最终将是:从数据库中获取页面内容(如博客文章)并显示.cshtml页面。
答案 0 :(得分:0)
如果您的应用包含对实体框架的引用,则需要完全信任
https://www.godaddy.com/help/do-your-hosting-accounts-support-mvc4-and-mcv5-applications-8999
编辑看起来像Asp.Net需要完全信任
asp.net mvc 5 entity framework 6 identity working with trust level = medium?