开发者

ASP.NET MVC - How to make it work with IIS6

开发者 https://www.devze.com 2023-01-13 09:10 出处:网络
I am having some issues with deploying my MVC 2 开发者_开发百科application on a IIS 6 server. I have the following project structure:

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?


See this walkthrough by Phil Haack.


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.

0

精彩评论

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

关注公众号