views:

282

answers:

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 logo page. Is there something special I need to configure to get the root url to show me the Home/index page by default?

A: 

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" });
Max Toro
neither of those work.
Micah
@Micah Well, I didn't say that's the only thing you need to do, but it's the most important first step, if you don't have a route that matches the URL then it will never be handled by MVC. If you didn't have that route then I'm glad to say I helped.
Max Toro
A: 

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.

çağdaş
It's setup to use the integrated pipeline, but still isn't working.
Micah
@Micah In that case, maybe you should post your routes in the question. It could help solving the issue.
çağdaş