开发者

Setting up the root url in IIS7 for asp.net mvc 2

I have a bit of a strange question. I'm building a multi tenant website with Asp.net MVC 2 and running it on IIS7. I'm trying to get my dev environment setup properly for testing but I'm having a weird issue though.

I created the website in IIS and pointed the directory to the location of my source code. I have just the basic HomeController along with an Index view setup. I have a binding in IIS on my website (and setup in my hosts file) for www.mydomain.com (this is so I can test the multi-tenant stuff).

When I run the site and I navigate to www.mydomain.com/home or www.mydomain.com/home/index everything pulls up fine. But navigating to www.mydomain.com gives me the IIS7 log开发者_如何学编程o page. Is there something special I need to configure to get the root url to show me the Home/index page by default?


You need to configure a route like this:

routes.MapRoute("home", "",
   new { controller = "home", action = "index" });

or this:

routes.MapRoute("home", "{action}",
   new { controller = "home", action = "index" });


Your application must be running in IIS7's integrated pipeline mode. Otherwise you're going to need that default.aspx from the default ASP.NET MVC 1 project template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜