MVC3 publishing and IIS 6

房东的猫 提交于 2019-12-06 07:33:17
Mangesh Pimpalkar

Try this.

  1. Open IIS manager.
  2. List item
  3. Select your website then properties.
  4. Go to Virtual directory
  5. Click on Configuration
  6. On Application Configuration
    Application extension - add .mvc extension and path C:\windows\microsoft.net\framework\v4.xxxxx\aspnet_isapi.dll
  7. On the wildcard application maps insert same path as above
  8. UNCHECK verify that file exists (if you check it won't run)

Phil Haack has a good article: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

I had the exact issue when moving from local development to a web server. For some reason, the server didn't have the proper mappings set up. Check the handler mappings configuration and make sure that all of the MVC related mappings are listed, e.g. ".cshtm" and ".cshtml" -- there should be several for each extension.

I had the same problem. Besides following all of the above steps, i also had to create a new website in IIS. All my production websites ran under the "Default Website". I had each application setup as a Virtual Directory. My "Default Website" runs ASP.NET 2.0. which is fine for all other applications. This doesn't work for MVC apps since it requires ASP.NET 4.0.

To solve the problem I did the following:

  1. Created a new application pool
  2. Created a new directory under inetpub and called it wwwroot4_0
  3. Moved my application to this location
  4. Created a new website and set the ASP.NET Version to 4.0.
  5. Under the new website, i gave it a different port, port 81
  6. Created the new application as a virtual directory under my new website
  7. Changed the routs of my application to include the extension .aspx

    routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );

The way I would access the application is this: www.mydomainname.com:81/MyAppName/Default.aspx

Please let me know if this helps anybody. Thanks.

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