Best way to deploy an ASP.NET MVC app on IIS 7 / Server 2008?

社会主义新天地 提交于 2019-12-04 13:37:23

问题


So far, the only successful strategy I've been able to get by with is the following:

  1. Configure YOURAPP.Web to "Use Local IIS Web Server" and set "Project Url" = http://localhost/yourapp.web
  2. Click "Create Virtual Directory"
  3. In IIS Manager ensure that "Classic .NET App Pool" is selected
  4. Add wildcard mapping * named "ASP.NET-MVC" that points to IsapiModule

BUT I don't really like the idea of having the full ASP.NET pipeline invoked when requesting any resource (javascript file, stylesheet, image, etc...) which is exactly what happens with the wildcard mapping.

So is there a way around this?

Is there a better method to running mvc apps on IIS 7?

I'm definitely open to suggestions as I'm not all that satisfied with what I got so far.

Thanks - wg


回答1:


Make sure IIS7's "Managed pipeline mode" is set to "Integrated". That has been the single most important thing to do (for me) to get my MVC app running smoothly on IIS7. Here's a good blog post too. When developing the app, I have had no issues using the "Visual Studio Development Server" for running the app.




回答2:


Assuming that all of your CSS/JS/image files reside in the Content directory, you could add an ignore route.

routes.IgnoreRoute("Content/{*wildcard}");

This will prevent any requests to the content directory being handled by MVC.




回答3:


IIS7 is designed to take all requests and push off the static file stuff efficently. I wouldn't worry about it in the same way one worries about wildcard mappings on IIS6. There is no "load ASP.NET pipeline" penalty because IIS7 is a mean honking ASP.NET pipeline all the time.



来源:https://stackoverflow.com/questions/1157988/best-way-to-deploy-an-asp-net-mvc-app-on-iis-7-server-2008

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