我有这个 MVC 应用程序,我在其中声明了以下路由:
routes.RouteExistingFiles = false;
routes.IgnoreRoute("Content/{*pathInfo}");
routes.IgnoreRoute("Scripts/{*pathInfo}");
routes.IgnoreRoute("{*alljs}", new { alljs = @".*\.js(/.*)?" });
routes.IgnoreRoute("{*allcss}", new { allcss = @".*\.css(/.*)?" });
我在 IIS 上部署了我的应用程序,我看到Application_BeginRequest
每个静态资源都调用了
protected void Application_BeginRequest(object sender, EventArgs e)
{
Log.Write("Begin request for " + Request.RawUrl)
}
我试图以web.Config
这种方式设置:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers accessPolicy="Read, Execute, Script">
<add name="StaticFiles" path="*.js, *.css, *.jpg, *.jpeg, *.gif, *.png" verb="*" type="StaticFileModule" resourceType="Either" requireAccess="None" preCondition="integratedMode" />
</handlers>
</system.webServer>
没有成功,很遗憾。有人对此有线索吗?