简体   繁体   中英

Set up RAMMFAR for certain paths only

I have an ASP.NET 4.5 MVC app. I don't want to set RAMMFAR ( runAllManagedModulesForAllRequests ) because that would needlessly send requests for static resources through the ASP.NET pipeline; however I do want all requests which begin with the path /Download/ to run through the ASP.NET routing pipeline, regardless of extension. This way I can route them to a Controller and serve dynamically generated resources.

How can this be done? I do not have access to IIS settings but hopefully there is a way to do this through web.config .

The RAMMFAR setting is per application. You'd have to create a separate IIS applications if you want different parts of the site to have different settings, but unfortunately you state this is not an option for you.

I two have two side notes though:

  1. Are you sure you even need RAMMFAR? I think that when using IIS 7.5 and newer it's very rarely needed because IIS and ASP.NET can pretty much handle managed/native requests correctly.
  2. Have you identified this as an actual problem to always have it enabled? Undoubtedly RAMMFAR will make things slower, but the question is whether it's causing a measurable effect in your app. Even if a static file does go through some managed code, the final processing of the file is handled back in native code. So there's a bit of extra work to go "through" the ASP.NET managed pipeline, but once that's done it's back to native IIS/Windows code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM