Deploying Asp.Net MVC 2 /C# 4.0 application on IIS 6

前端 未结 4 622
深忆病人
深忆病人 2020-12-28 19:03

I got a problem migrating from VS.Net 2008 / MVC 1 to VS.NET 2010 (+C# 4.0) / MVC 2

The web.confi

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 19:18

    This finally fixed it for me:

    I commented earlier, and a wee bit prematurely. My comment to Mark B's post was getting my initial Index view to show up, but then I kept getting the 404 errors whenever I navigated to any other view.

    I was also distracted by the green check mark approved solution in this particular forum, but I could not even see the web server extensions folder in IIS 6 on my desktop; therefore, I had no control from that stand point of enabling aspnet 4.0, though I made sure it was installed by performing running the following command line:

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis -i
    

    Now for the actual piece that finally allowed me to navigate to the other views besides just my Home/Index:

    In the Global.asax.cs file of your VS 2010 Solution, you will see code as follows in the RegisterRoutes method:

      routes.MapRoute(
          "Default", // Route name
          "{controller}/{action}/{id}", // URL with parameters
          new { controller = "Home", action = "Index", id = UrlParameter.Optional });
    

    I simply added ".aspx" after the {action} section of the tag as follows:

      routes.MapRoute(
          "Default", // Route name
          "{controller}/{action}.aspx/{id}", // URL with parameters
          new { controller = "Home", action = "Index", id = UrlParameter.Optional });
    

    And ahla wahla Peanut Butter and Jelly sandwiches. :0)

提交回复
热议问题