加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-3 – ASP.NET MVC 3 RTM项目中的这个错误是什么?

发布时间:2020-12-15 23:48:37 所属栏目:asp.Net 来源:网络整理
导读:我创建新的项目ASP.NET MVC 3 RTM和替换引用 使用ASP.NET MVC 3源代码 但是当我再次运行项目时,得到这个例外: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
我创建新的项目ASP.NET MVC 3 RTM和替换引用
使用ASP.NET MVC 3源代码

但是当我再次运行项目时,得到这个例外:

[A]System.Web.WebPages.Razor.Configuration.HostSection
cannot be cast to
[B]System.Web.WebPages.Razor.Configuration.HostSection.
Type A originates from
‘System.Web.WebPages.Razor,
Version=1.0.0.0,Culture=neutral,
PublicKeyToken=31bf3856ad364e35’ in
the context ‘Default’ at location
‘C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPages.Razorv4.0_1.0.0.0__31bf3856ad364e35System.Web.WebPages.Razor.dll’.
Type B originates from
‘System.Web.WebPages.Razor,
PublicKeyToken=null’ in the context
‘Default’ at location
‘C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary
ASP.NET
Filesroot2505c7ee369315c5assemblydl3f7bae428d03eeed8_85bbcb01System.Web.WebPages.Razor.DLL’.

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.

源错误:

Line 106:        internal static RazorWebSectionGroup GetRazorSection(string virtualPath) {
Line 107:            // Get the individual sections (we can only use GetSection in medium trust) and then reconstruct the section group
Line 108:            return new RazorWebSectionGroup() {
Line 109:                Host = (HostSection)WebConfigurationManager.GetSection(HostSection.SectionName,virtualPath),Line 110:                Pages = (RazorPagesSection)WebConfigurationManager.GetSection(RazorPagesSection.SectionName,virtualPath)

Source File:
E:GreenTourwebpagessrcSystem.Web.WebPages.RazorWebRazorHostFactory.cs
Line: 108

解决方法

此错误意味着您的应用程序的一部分正在使用您自己的源代码副本作为参考进行编译,而在运行时,它会在GAC中查找引用程序集.确保删除对GACed版本的MVC 3程序集的所有引用.这包括使用此公钥令牌的web.config文件中的一些内容:31bf3856ad364e35.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读