Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 462
James Avatar asked Nov 12 '22 14:11

James


1 Answers

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.
like image 120
Eilon Avatar answered Nov 15 '22 06:11

Eilon