Using IIS Application Request Routing (ARR) for ASP.NET MVC

让人想犯罪 __ 提交于 2019-11-30 09:06:20

In the Global.asax.cs file add the following route entry:

routes.IgnoreRoute("Shop/{*pathInfo}"); 

This solved by me the problem.

It appears that the MVC routing system kicks in before ARR, which makes sense when running in integrated mode.

We have almost the exact same setup you describe. We found that MVC and ARR won't plan nice in the same site. I suspect because the MVC routing and ARR routing do similar things and interfere. To work around it, we had to put just the ARR rules in a separate website. The domain and everything points to the ARR site, which will then send the requests where they need to go.

We have specific rules that handle the specific cases, and a catch-all rule at the end that sends the rest of the requests to the MVC site.

It sounds like the HttpModules for ASP.Net MVC and ARR are registered in the wrong order.

Can you show us your web.config?

Basically the problem is the ASP.NET MVC app isn't quite expecting /Shop to be part of the url and is acting accordingly. The best way to fix this would be to deploy the MVC app into an application living in the proxied site at /Shop. Then there will not need to be a translation to a sub URI and all the fun that can entail.

I've just found that if you place rewrite rules on the server level they will be saved to %systemroot%\system32\inetsrv\config\applicationHost.config inside system.webServer\rewrite\globalRuels and will work.

But I am still wondering why it does not work with rules in Web.config.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!