asp.net core configuration file download

Save static files when asp.net core of default wwwroot folder where direct access to the outside, but if some unrecognized file extension, such as (.apk), being given 404

If you want to achieve download these files, make the following settings when configuring a static file middleware:

app.UseStaticFiles(new StaticFileOptions() {
                ServeUnknownFileTypes = true,
                DefaultContentType = "application/x-msdownload" });

Guess you like

Origin www.cnblogs.com/maycpou/p/11578204.html