Running MVC2 Application on IIS 5.2

限于喜欢 提交于 2019-12-08 04:32:14

问题


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.

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

I am getting an HTTP 403 Forbidden page.

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

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
        );

回答1:


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.

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.

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.

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.

In Extension field write .mvc.

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.

Mark 2 checkboxes at bottom.

Now you can save it by clicking on OK button.

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

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 :)




回答2:


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

and also for

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


来源:https://stackoverflow.com/questions/3506381/running-mvc2-application-on-iis-5-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!