我有这样的MVC应用程序,我声明如下路线:应用程序调用Begin_Request图片,CSS和JS ASP.NET MVC 3
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>
不幸的是,没有成功。任何人都有这方面的线索?
你为什么使用'BeginRequest'? – SLaks
实例化数据库会话。 – abx78
你可以配置IIS以便它提供静态文件吗?它不需要实例化一个asp.net进程。 – Dallas