在IIS 5.2上运行MVC2应用程序 [英] Running MVC2 Application on IIS 5.2

查看:124
本文介绍了在IIS 5.2上运行MVC2应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近创建了一个MVC2应用程序.我在运行IIS 5.2的Windows 2003 Server上启动它时遇到麻烦.我的开发机器是Server 2008,因此那里没有问题.

I recently created an MVC2 application. I am having trouble bringing it up on a Windows 2003 Server running IIS 5.2. My developing machine is Server 2008, so no problems there.

我在Server 2003上所做的更改是创建*的通配符脚本映射,并将其指向:c:\ windows \ microsoft.net \ framework \ v4.0.30319 \ aspnet_isapi.dll

Changes I made on Server 2003 is Creating a Wildcard Script Map of * and pointing that to: c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll

我正在获取HTTP 403禁止页面.

I am getting an HTTP 403 Forbidden page.

我创建了一个单独的应用程序池,并使用.Net 4运行它.

I created a separate apppool and am running that using .Net 4

这是我的global.asax

Here is my global.asax

routes.MapRoute(
            "Default", // Route name
            "{controller}.mvc/{action}/{id}", // URL with parameters
            new { action = "Index", id = "" } // Parameter defaults
        );

        routes.MapRoute(
            "Root", // Route name
            "", // URL with parameters
            new { controller = "Home", action = "Index", id = "" } // Parameter defaults
        );

推荐答案

在尝试在IIS 5.1服务器上运行我的MVC2应用程序时,我遇到类似的问题.我已经失去了很多时间,但最终我开始工作了.

I have similar problem while trying to get working my MVC2 application on IIS 5.1 server. I have lost many hours but finally I got it working.

您的Global.asax看起来不错,但是还有另一件事.在IIS服务器上,缺少.mvc文件的映射.您必须添加它才能使您的应用程序正常工作.

Your Global.asax looks good, but there is one another thing. On IIS server there is missing mapping for .mvc files. You have to add this in order to get your app works.

转到IIS,然后向上滚动Web sites并右键单击Default Web Site并选择Home directory.现在单击Configure按钮.单击Add为了添加新的映射扩展名.

Go to you IIS, then roll-up Web sites and right click on Default Web Site and select Home directory. Now click on Configure button. Click on Add in order to add new mapping extension.

Executable字段中,将您的路径粘贴到aspnet_isapi.dll文件中.通常在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll下.

In Executable field paste your path to aspnet_isapi.dll file. Usually it's under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll.

Extension字段中输入.mvc.

在任务中(我可能对此名称不正确,因为我没有使用IIS的英文版)标记第二个选项并粘贴GET,HEAD,POST,DEBUG.

At tasks (I may be wrong about this name, cause I'm not using English version of IIS) mark second option and paste GET,HEAD,POST,DEBUG.

在底部标记2个复选框.

Mark 2 checkboxes at bottom.

现在,您可以通过单击确定"按钮来保存它.

Now you can save it by clicking on OK button.

最后一个提示.如果确定"按钮被禁用,则只需单击具有Executables的字段,然后应启用它.

One tip at the end. If OK button is disabled then just click on a field with Executables and it should be enabled then.

编辑:这是另一个提示.在IIS 5.x下运行MVC应用程序是很成问题的.您必须小心所有路径.例如,要在SiteMaster页面中包含jQuery库,您必须使用:

Edit Here's another tip. It is quite problematic to run MVC application under IIS 5.x. You have to be careful with all paths. For example to include jQuery library in SiteMaster page you have to use:


<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-1.4.2.min.js") %>"></script>

希望这对您有用,并且为您节省了一些时间:)

Hope this works for you and it saved you some time :)

这篇关于在IIS 5.2上运行MVC2应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆