gpt4 book ai didi

.net - "Operation could destabilize the runtime"尝试从 MVC3 升级到 MVC4 时

转载 作者:行者123 更新时间:2023-12-04 14:47:43 27 4
gpt4 key购买 nike

Server Error in '/' Application.

什么是解决这个问题的好方法?我让调试单步执行 global.asax 中的所有内容,并且那里没有错误。
Operation could destabilize the runtime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Security.VerificationException: Operation could destabilize the runtime.

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:


[VerificationException: Operation could destabilize the runtime.]
System.Web.Mvc.Razor.MvcWebPageRazorHost.GetRidOfNamespace(String ns) +32
System.Web.Mvc.Razor.MvcWebPageRazorHost..ctor(String virtualPath, String physicalPath) +199
System.Web.Mvc.MvcWebRazorHostFactory.CreateHost(String virtualPath, String physicalPath) +113
System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfigCore(RazorWebSectionGroup config, String virtualPath, String physicalPath) +422
System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath, String physicalPath) +228
System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath) +38
System.Web.WebPages.Razor.RazorBuildProvider.CreateHost() +51
System.Web.WebPages.Razor.RazorBuildProvider.get_Host() +56
System.Web.WebPages.Razor.RazorBuildProvider.EnsureGeneratedCode() +92
System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType() +54
System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) +59
System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() +209
System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +15
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +9929933
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +299
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +165
System.Web.Compilation.BuildManager.GetObjectFactory(String virtualPath, Boolean throwIfNotFound) +33
System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath) +40

最佳答案

尽管我的项目是 .Net 4.5,但我遇到了完全相同的问题。我按照 Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4 的第 7 步解决了它

复制到这里如下:

7.如果项目引用了使用以前版本的ASP.NET MVC编译的任何第三方库,请打开根Web.config文件并在配置部分下添加以下三个bindingRedirect元素:

 <configuration>
<!--... elements deleted for clarity ...-->

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers"
publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc"
publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages"
publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

关于.net - "Operation could destabilize the runtime"尝试从 MVC3 升级到 MVC4 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12219689/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com