2
Vote

.Net 4.0 routing failing

description

I'm having an issue trying to use the .net 4.0 routing feature in a wcsf project. After some research i have found that it is related with the change in the inheritance chain of the Global class.
 
the routing with this global.asax file works perfect
 
public class Global : System.Web.HttpApplication {
    public Global()
        : base()
    {
    }
 
    protected void Application_Start(object sender, EventArgs e)
    {

        RegisterRoutes(RouteTable.Routes);
 
    }
 
    protected void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute(
            RoutingHelper.DEVELOPER_ROUTE_NAME,
            RoutingHelper.DEVELOPER_ROUTE,
            RoutingHelper.DEVELOPER_PAGE_PATH);
 
        routes.MapPageRoute(
            RoutingHelper.PRODUCT_ROUTE_NAME,
            RoutingHelper.PRODUCT_ROUTE,
            RoutingHelper.PRODUCT_PAGE_PATH);
    }
}
 
but fails, (404 error) with this one:
 
public class Global : Microsoft.Practices.CompositeWeb.WebClientApplication //System.Web.HttpApplication
{
    public Global()
        : base()
    {
    }
 
    protected override void Application_Start(object sender, EventArgs e)
    {
        base.Application_Start(sender, e);
 
        RegisterRoutes(RouteTable.Routes);
 
    }
 
    protected void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute(
            RoutingHelper.DEVELOPER_ROUTE_NAME,
            RoutingHelper.DEVELOPER_ROUTE,
            RoutingHelper.DEVELOPER_PAGE_PATH);
 
        routes.MapPageRoute(
            RoutingHelper.PRODUCT_ROUTE_NAME,
            RoutingHelper.PRODUCT_ROUTE,
            RoutingHelper.PRODUCT_PAGE_PATH);
    }
}
 
i'm running the WAP in a Windows 7, 64 bits, VS 2010, WCSF 2010, IIS 7.5
 
Any help would be appreciated
 
Thanks

comments

fantivero wrote Aug 27, 2010 at 8:06 PM

Hi,

I tried it myself and found an issue when running a WCSF application with .NET Routing on IIS since it is returning an error 404 accessing a routed resource, as you mentioned. Although supporting .Net routing has not been part of the scope of WCSF 2010, I will continue researching about this and try to find a possible workaround.

I will back to you if I have any progress on this.

Fernando Antivero
http://blogs.southworks.net/fantivero

wrote Oct 6, 2011 at 9:51 AM

ST_bobr wrote Oct 6, 2011 at 9:56 AM

I found the same behavior. Also using the Windows 7, 64 bits, VS 2010, WCSF 2010, IIS 7.5.

wrote Feb 21, 2013 at 11:02 PM