samedi 9 mai 2015

ASP vNext deployed on Azure does not render static files with a catch all rule

I just deployed for the first time a Single Page Application on azure which is based on ASP vNext and AngularJs.

I have created two rules for my routes.

The first one is for my APIs and the second is to catch all other requests which will show the Layout.cshtml and then be handled by Angular.

On my local machine, everything is working fine, but on azure, my static files shows the Layout.cshtml file like if it is catched by the catch all rule even though I specified in the Startup.cs file that I wanted ASP to handle static files.

Did anyone encountered that problem before ? And if yes, what would be the solution to fix this ?

Thanks.

app.UseStaticFiles(option);

// Add MVC to the request pipeline.
app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "WebApi",
        template: "api/{controller}/{action}/{id?}");

    routes.MapRoute(
        "Default", // Route name
        "{*url}", // URL with parameters
        new { controller = "Home", action = "Index" } // Parameter defaults
    );
});

Aucun commentaire:

Enregistrer un commentaire