在 web.config 中,定义了重复的 'system.web.webPages.razor / host' 部分

In web.config, A duplicate 'system.web.webPages.razor / host' section is defined

我正在尝试 运行 这个应用程序 https://github.com/martinokello/EntertainmentTicketMaster

但是当我运行这个应用程序时,出现了一些错误。


IIS Web 核心模块

通知开始请求

处​​理程序尚未确定

错误代码 0x800700b7

配置错误定义了重复的 'system.web.webPages.razor / host' 部分。

请求URLhttp://localhost:6848/Views/Account/Login.cshtml

物理路径F:\code\EntertainmentTicketMaster-

master\EntertainmentTicketMaster\Views\Account\Login.cshtml

登录方法尚未确定

登录用户尚未确定

请求跟踪目录C:\Users\young\Documents\IISExpress\TraceLogFiles\ENTERTAINMENTTICKETMASTER

配置源

 5:     <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    6:       <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    7:       <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

我搜索了几篇文章来解决这个错误,但都没有用。

以上配置错误表示定义了重复的 'system.web.webPages.razor / host' 部分。

然后我检查了一下。

并且在根目录和视图文件夹的 web.config 中都定义了与此错误相关的代码。

 5:     <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    6:       <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    7:       <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

导致此错误的原因是什么,我该如何解决? 请帮助我。

And this codes which are related to this error are defined in both web.config of root directory and view folder.

这就是您收到此错误的原因。您应该只在根目录中定义它。