You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interestingly enough, deploying this to an azure app service still produces this error. @MarkPieszak Have you encountered a similar error on unusual mime types before?
PS: Default VS 2017 angular template works without adding mimemap for properties file.
The text was updated successfully, but these errors were encountered:
codehippie1
changed the title
Adding mime types
Adding mime types produces 404
Jul 1, 2019
Aspnet core does not honor webserver->staticcontent->mimetypes as described in these posts. In short, static file requests in this case does not reach IIS express to be served, hence web.config modifications has no effect.
var provider = new FileExtensionContentTypeProvider();
provider.Mappings.Remove(".properties");
provider.Mappings[".properties"] = "application/octet-stream";
app.UseStaticFiles (new StaticFileOptions () {
ContentTypeProvider = provider, // <----- HERE
OnPrepareResponse = c => {
//Do not add cache to json files. We need to have new versions when we add new translations.
c.Context.Response.GetTypedHeaders ().CacheControl = !c.Context.Request.Path.Value.Contains (".json")
? new CacheControlHeaderValue () {
MaxAge = TimeSpan.FromDays (30) // Cache everything except json for 30 days
}
: new CacheControlHeaderValue () {
MaxAge = TimeSpan.FromMinutes (15) // Cache json for 15 minutes
};
}
});
I have been trying to get mime maps working on this repository.
Every http request to unknown mime types (On IIS Express and Azure web apps) results in 404 error.
Steps.
GET http://localhost:63554/assets/sample.properties 404 (Not Found))
What did I try.
appcmd set config /section:staticContent /+[fileExtension='properties',mimeType='application/octet-stream']
from IIS Express folder(C:\Program Files(x86)\IIS Express) in command line(as admin)Here is full web.config
Interestingly enough, deploying this to an azure app service still produces this error.
@MarkPieszak Have you encountered a similar error on unusual mime types before?
PS: Default VS 2017 angular template works without adding mimemap for
properties
file.The text was updated successfully, but these errors were encountered: