You may get an HTTP Error 404 when browsing/downloading a static file like .Apk when the client should be downloaded after publishing asp.net core application to the host. 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 sort out the problem.
using Microsoft.AspNetCore.StaticFiles;
var builder = WebApplication.CreateBuilder(args);
...
var app = builder.Build();
...
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
{
{".apk", "application/vnd.android.package-archive"},
{".nupkg", "application/zip"}
})
});
...
app.Run();