views:

55

answers:

2

I am having some issues with deploying my MVC 2 application on a IIS 6 server.

I have the following project structure:

/
   App/
      Controllers/
      Helpers/
      Infrastructure/
      Models/
      Views/
   Public/          # This folder contains CSS and JS files
   Global.asax
   Web.config

I have a custom System.Web.Mvc.WebFormViewEngine that tells my application to lookup the views in /App/Views instead of the default /Views.

It works fine on Cassini and IIS 7.5.

I need to deploy my application in a virtual directory on IIS 6 and I am getting 404 errors when trying to access any of my controllers.

I read that I needed to add a Default.aspx with the following code behind:

protected void Page_Load( object sender, EventArgs e ) {
    HttpContext.Current.RewritePath( Request.ApplicationPath, false );
    IHttpHandler httpHandler = new MvcHttpHandler();
    httpHandler.ProcessRequest( HttpContext.Current );
}

It actually called my default controller, and showed the corresponding view, but it's the only page I've been able to get so far.

I tried to enable the wildcard mapping, it didn't change anything. But I'm using ASP.NET 4.0, and it enables routing of extension-less URLs.

I'm not really sure what to do now, I'm not finding any other helpful sources of information on the Internet.

How could I make it work?

+2  A: 

See this walkthrough by Phil Haack.

RedFilter
I've read it a thousand times, and it's not helping me at all. I pretty much have the same configuration. Everything he says in that post is to enable wildcard mapping or use file extensions and change your routes.
Bertrand Marron
It didn't really solve my problem, but I kind of solved it by adding a new application pool on IIS 6. I'm accepting this answer since that walk-through is a very good resource.
Bertrand Marron
+1  A: 

Can't comment yet, but that walkthrough is it. I did wildcard myself.

It was a while ago, so I don't remember the damn details of what I had to do to get it fixed now, but it took me a few hours. I was missing some really small detail in his instructions, if I remember correctly. What error/incorrect behavior are you getting? You might trigger my memory.

Bob Housedorf
I thought you didn't have to use wildcard mapping with ASP.NET 4.0 since it enables extension-less routing. I created a new application pool for my application instead of using the default one. I did everything again (including enabling wildcard mapping) and now it works.
Bertrand Marron
I think IIS 6 is still a little bass ackwards.Glad you got it working.
Bob Housedorf