ASP.NET Core - Download .exe returns 404 error

前端 未结 2 1587
一生所求
一生所求 2021-01-17 13:09

I have a ASP.NET core MVC application and in the wwwroot folder, I\'ve added another folder called \"Shaun\" and in that folder I\'ve dropped an exe to try and download:

2条回答
  •  自闭症患者
    2021-01-17 13:35

    In order for static files (.exe file is a static file type) to be served, you must configure the Middleware to add static files to the pipeline. The static file middleware can be configured by adding a dependency on the Microsoft.AspNetCore.StaticFiles package to your project and then calling the UseStaticFiles extension method from Startup.Configure:

    public void Configure(IApplicationBuilder app)
    {
        app.UseStaticFiles();
    }
    

提交回复
热议问题