I've just installed the preview on Windows Server 2003. I've created a new MVC Application and it works fine with the build-in webserver. However, when I "publish" the application to clean virtual directory under IIS6, the website just loads with a blank
page (since default.aspx is blank). Looks like the handlers aren't getting hooked up correctly.
The ISAPI mapping for MVC was already installed, but what I'd failed to do (in my excitement to get out the gate) was to make the required changes to the default routes. On closer inspection of the situation, there it was, in glorious green on white...
// Note: Change Url= to Url="[controller].mvc/[action]/[id]" to enable
// automatic support on IIS6
System.Diagnostics.Debugger.Launch();
RouteTable.Routes.Add(new Route
{
Url = "[controller].mvc/[action]/[id]",
Defaults = new { action = "Index", id = (string)null },
RouteHandler = typeof(MvcRouteHandler)
});
I give up. I changed my routes to include .mvc after the controller name just as the example shows and I get 404 errors anytime I try to move past the default page. When I use the internal VS2008 browser everything works fine so I'm assuming I don't have
something set up right. What exactly do you have to do in IIS to route mvc to the asp net isapi filter?
Is IIS configured with ASP.NET? Easiest way to check is to look at properties of the virtual directory (or web site if at the root) you are using. On the Virtual Directory tab (or Home Directory tab on root folder) select the configuration button and check
that the usual ASP.NET extensions are mapped to the .NET 2.0 ISAPI dll. This will be something like
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll.
.mvc should be mapped to the same file, but, with verbs "GET,HEAD,POST", script engine selected and verify the file exists
not selected.
Has ASP.NET 2 been enabled on IIS (under IIS 6 by default it is not): in IIS manager check the Web Service Extensions folder to enable it.
Finally it is always worth checking that the virtual directory is pointing to the right location... try creating a "test.htm" file in the root of your project... can yuu browse that file?
I figured out the issue. When you set it, it brings up a list of sites to use the new setting on and I thought I selected them all but I had not, so while it was set, it wasn't being used.
I know this is an old thread, but just in case someone goes searching (like I did)...
I was having the same kinds of problems, and was getting really frustrated that I didn't have any control over the server, and the following link was *very* helpful:
theshadow330
Member
10 Points
17 Posts
MVC application not running under IIS6
Dec 10, 2007 10:10 AM|LINK
I've just installed the preview on Windows Server 2003. I've created a new MVC Application and it works fine with the build-in webserver. However, when I "publish" the application to clean virtual directory under IIS6, the website just loads with a blank page (since default.aspx is blank). Looks like the handlers aren't getting hooked up correctly.
Is this the expected result?
Any idea how to fix it appropriately?
Andrew
iis6
JamesSteele
Member
224 Points
34 Posts
Re: MVC application not running under IIS6
Dec 10, 2007 11:42 AM|LINK
Hi Andrew,
With IIS7 you can just rely on the URL mapping features of the server to map the MVC file type.
With IIS6 you can do one of two things:
1 - Setup an ISAPI filter to map MVC URLs to ASP.NET
2 - Include an extension in the URL. For example: http://localhost/Home.mvc
theshadow330
Member
10 Points
17 Posts
Re: MVC application not running under IIS6
Dec 10, 2007 04:32 PM|LINK
Thanks James,
The ISAPI mapping for MVC was already installed, but what I'd failed to do (in my excitement to get out the gate) was to make the required changes to the default routes. On closer inspection of the situation, there it was, in glorious green on white...
// Note: Change Url= to Url="[controller].mvc/[action]/[id]" to enable // automatic support on IIS6 System.Diagnostics.Debugger.Launch(); RouteTable.Routes.Add(new Route { Url = "[controller].mvc/[action]/[id]", Defaults = new { action = "Index", id = (string)null }, RouteHandler = typeof(MvcRouteHandler) });*red face*Stormbringer...
Member
4 Points
2 Posts
Re: MVC application not running under IIS6
Jan 19, 2008 09:49 PM|LINK
I give up. I changed my routes to include .mvc after the controller name just as the example shows and I get 404 errors anytime I try to move past the default page. When I use the internal VS2008 browser everything works fine so I'm assuming I don't have something set up right. What exactly do you have to do in IIS to route mvc to the asp net isapi filter?
ASP.NET MVC iis6
rjcox
Contributor
7064 Points
1444 Posts
Re: MVC application not running under IIS6
Jan 20, 2008 06:55 AM|LINK
Is IIS configured with ASP.NET? Easiest way to check is to look at properties of the virtual directory (or web site if at the root) you are using. On the Virtual Directory tab (or Home Directory tab on root folder) select the configuration button and check that the usual ASP.NET extensions are mapped to the .NET 2.0 ISAPI dll. This will be something like C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll.
.mvc should be mapped to the same file, but, with verbs "GET,HEAD,POST", script engine selected and verify the file exists not selected.
Has ASP.NET 2 been enabled on IIS (under IIS 6 by default it is not): in IIS manager check the Web Service Extensions folder to enable it.
Finally it is always worth checking that the virtual directory is pointing to the right location... try creating a "test.htm" file in the root of your project... can yuu browse that file?
Stormbringer...
Member
4 Points
2 Posts
Re: MVC application not running under IIS6
Feb 07, 2008 09:48 PM|LINK
I figured out the issue. When you set it, it brings up a list of sites to use the new setting on and I thought I selected them all but I had not, so while it was set, it wasn't being used.
Thanks.
code_slave
Member
2 Points
1 Post
Found Help
Apr 07, 2009 07:20 PM|LINK
I know this is an old thread, but just in case someone goes searching (like I did)...
I was having the same kinds of problems, and was getting really frustrated that I didn't have any control over the server, and the following link was *very* helpful:
http://www.asp.net/learn/mvc/tutorial-08-cs.aspxASP.NET MVC MVC IIS *.mvc extension pagenotfound Routes iis6 routing deploy mvc admin routetable routes MVC ASP.NET Deployment mvc routing asp mvc iis6 mvc deploy routes route C# url rewriting MVC deployment Asp.Net MVC Framework ASP mvc 404 route mvc url.action iis 6 Deployment Problem routeUrl asp mvc errors MVC 404 ASP.NET mvc asp mvc c# routing html helper routing 404 mvc publishing routing problems ASP.NET MVC Routing ASP asp.net mvc mvc shared hosting aps.net mvc routeing ASP.NET mvc route routes asp.net-mvc global.asax route MVC Routing Controller URL Routing MVC mvc error exception html asP asp.net mvc iis mapping MVC URL Mapping "ASP.NET MVC" Asp.net mvc URL routing friendly MVC routing 404 error ASP.NET MVC" ASP asp.net mv aspnetmvc 404 System.Web.HttpException