代码改变世界

[整理]iis7.5下部署MVC5

2015-05-13 18:05  Benoly  阅读(1557)  评论(0编辑  收藏  举报

IIS7.5下部署MVC5

测试环境服务器部署
windows server 2008 r2

1.安装iis 7.5

2.安装 .net framework4.5.1并注册

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis -ir

C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis -ir

iisreset /restart

3.部署站点,选择程序池 集成或经典 都可

设置默认页面为站点下存在的default.html
至此,站点可以访问,但mvc路由和webapi 访问返回404。

4.iis7.5里【ISAPI和CGI限制】中开启asp.net v4.0.30319 32bit /64bit扩展

5手动在bin里添加

Microsoft.Web.Infrastructure.dll
System.Web.Optimization.dll

至此,webapi也可以正常访问了。
但是,直接访问http://xxx.xxx.xxx.xxx:8086/ 返回404,默认主页已经设置为default.html,但是无效,必须访问http://xxx.xxx.xxx.xxx:8086/default.html才有效

好吧,感觉应该是mvc route默认设置的问题,取消了//RouteConfig.RegisterRoutes(RouteTable.Routes); 就OK了。