Reputation: 2234
When I refer to an ".apk"
file in the browser whether it be http
or https
response is error 404
and it don't start to download that file.
The address of ".apk"
is
http://example.com/Upload/App/a.apk
and to verify that I'm pointing to correct address I've placed a picture file in that location (http://example.com/Upload/App/a.png
) and I could open the picture by browser.
I've searched over stackoverflow and google and tried everything on several first pages but all of them are providing the same contents and while the provided solution is working for everyone it doesn't work for me.
I've done this steps as provided in all articles, questions, documentations:
IIS
manager I've selected website and clicked on MIME Types
Add
hyper link and defined a new MIME Type
".apk"
for extention and "application/vnd.android.package-archive"
for MIME TypeI've realized this lines has been added to web.config automatically:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
</staticContent>
</system.webServer>
After defining the new MIME Type
I've restarted website, restarted whole IIS
service, I still get a 404 error
it is appreciated if someone could guide me how to debug the problem from this point.
As suggested in comments I've enabled Troubleshooting Failed Requests Using Tracing:
Headers="Connection: close
Accept:
text/html,application/xhtml+xml,
application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-
exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Upvotes: 5
Views: 3770
Reputation: 2234
My search over stackoverflow and google was wrong. My deployed project on IIS
is a .Net Core
website and it seems in .Net Core
projects there is no need to add new MIME Types
in IIS
server. Instead MIME Types
are handled in Configure()
method inside Startup.cs
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".apk"] = "application/vnd.android.package-archive";
app.UseStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider
});
Upvotes: 8