404 when download static file from ASP.NET Core

Programming, error messages and sample code > ASP.NET
You may get an HTTP Error 404 when browsing a static file like .apk (which should be downloaded to the client) after publishing your application to your account. This means there is no matched MIME type for the target file extension in the FileExtensionContentTypeProvider to process the request. You can add the specific MIME type from your application Program.cs file to solve the problem.
For example:
using Microsoft.AspNetCore.StaticFiles;

var builder = WebApplication.CreateBuilder(args);


var app = builder.Build();



app.UseStaticFiles(new StaticFileOptions
    ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
        {".apk", "application/vnd.android.package-archive"},
        {".nupkg", "application/zip"}