我通过 NuGet 安装了 MVC 5 的 RouteJS 并按照安装说明进行操作,但尝试加载时返回 _Layout.cshtml 的内容和状态 200 <script src='/routejs.axd/251810a87f19ffe842a619acc9a90d73349ba4fa/router.js'></script>
。
我正在运行 MVC 5、C# 和 IIS Express 8。我尝试了在其 GitHub / NuGet 网站上找到的 Web.config 的新变体。如果我使用区域,是否需要额外配置?
#_Layout.cshtml
#This works
<script src="@RouteJs.RouteJsHandler.HandlerUrl"></script>
#Web.config
<configSections>
<section name="routeJs" type="RouteJs.RouteJsConfigurationSection, RouteJs" />
</configSections>
#This section by itself will break the application.
#Added the 'validation' line to system.webServer to prevent an error
#I've tried running RouteJS with and without this section.
<system.web>
<httpHandlers>
<add verb="GET" path="routejs.axd" type="RouteJs.RouteJsHandler, RouteJs" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<validation validateIntegratedModeConfiguration="false"/>
<add name="RouteJs" verb="GET" path="routejs.axd" type="RouteJs.RouteJsHandler, RouteJs" />
</handlers>
</system.webServer>
<routeJs exposeAllRoutes="true" />
#RegisterRoutes
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");