简体   繁体   English

ASP.NET MVC-如何使其与IIS6一起使用

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

I am having some issues with deploying my MVC 2 application on a IIS 6 server. 我在IIS 6服务器上部署MVC 2应用程序时遇到一些问题。

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 . 我有一个自定义的System.Web.Mvc.WebFormViewEngine ,它告诉我的应用程序在/App/Views查找视图,而不是默认的/Views

It works fine on Cassini and IIS 7.5. 它在Cassini和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. 我需要将应用程序部署在IIS 6上的虚拟目录中,尝试访问任何控制器时出现404错误。

I read that I needed to add a Default.aspx with the following code behind: 我读到我需要添加一个Default.aspx ,后面加上以下代码:

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 . 但是我使用的是ASP.NET 4.0, 它支持路由无扩展名的URL

I'm not really sure what to do now, I'm not finding any other helpful sources of information on the Internet. 我不确定现在该怎么办,也找不到Internet上其他有用的信息来源。

How could I make it work? 我该如何运作?

请参阅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. 您可能会触发我的记忆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM