Reputation: 1896
I am trying to host a MVC2 website to IIS. Steps I have followed:
But when I tried to browse my site it was giving me error
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
So, I enabled Directory Browsing feature, Now it only shows directory listing. What I have tried?
My routing configurations are
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}
Upvotes: 6
Views: 10631
Reputation: 5307
install mvc application with this command
install-windowsfeature web-asp-net45
or install ASP.Net 4 in role server in server managment Detail
Upvotes: 0
Reputation: 903
have you found a solution? I've been facing the same issue for hours. Here is my strange story.
I was configuring a fresh win srv 2008 R2 with IIS installed through role (7.5....) and Added the same components I have in my dev environment's IIS. I thought that my system had got .net fw 4.0 because I've been able to crate asp.net 4.0 app pools, maybe because I had already had the 4.5 installed. I had also checked the asp.net installed versions on IIS through aspnet_regiis.exe -lv and my ASP.NET v.4.0.... was magically there in both 32 and 64 bit versions.
but...
I noticed something strange watching at the Default Web Site structure: I had only the aspnet_client\system_web\2_0_50707 folder. So the 4.0.... folder was missing.
My solution. I've uninstalled .net 4.5 from the server, then installed the v.4.0 downloading the package from microsoft. Then I've registered my aspnet 4.0 version using the aspnet_regiis -i present in its folder (%windir%\Microsoft.NET\Framework64\v4.0.30319).
After reinstalling my mvc3/razor web app, everything worked fine, even without installing mvc3 components on the server.
Morale, ensure that you have the fw version of your choice really installed in the system and configured in iis (aspnet).
Hope this helps.
Ciao.
Upvotes: 0
Reputation: 1039448
Here are the things you might check:
aspnet_regiis.exe
tool: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -
ir
(adapt the paths with the proper version of the framework if necessary).Upvotes: 4