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
while using the StaticFilesMiddleware I noticed that the ".json" extension is not known in the FileExtensionContentTypeProvider, thus JSON files are not delivered if "ServeUnknownFileTypes" is set to false.
Is this a similar oversight like how old versions of IIS (IIRC Windows Server 2008 R2) did not serve .json files by default, while newer versions (IIRC Windows Server 2013) do so, or did you leave that file type out for a good reason?
Kind regards,
Alexander
The text was updated successfully, but these errors were encountered:
You could (temporarily at least) either add a passthrough provider including JSON or proxy the ASP.NET Core 2.2 version.
I did a very rough proof of concept for that here.
<:thought_balloon:>
It is a pity, in some respects, that the separate nuget packages targeting netstandard were dropped, or that some of these kinds of facilities weren't kept in a separate package altogether.
I could definitely see scenarios where inferring the content type from a file extension would be useful - a command line or even MAUI (batch) upload to azure blob storage comes immediately to mind.
You can see this kind of issue at https://github.com/dotnet/aspnetcore/blob/main/src/Components/WebView/WebView/src/FileExtensionContentTypeProvider.cs where it even comments of this problem in the source of the class
// NOTE: This file is copied from src/Middleware/StaticFiles/src/IContentTypeProvider.cs// and made internal with a namespace change.// It can't be referenced directly from the StaticFiles package because that would cause this package to require// Microsoft.AspNetCore.App, thus preventing it from being used anywhere ASP.NET Core isn't supported (such as// various platforms that .NET MAUI runs on, such as Android and iOS).
There is also the duplication of the mediatype/content type strings in the MediaTypeNames class in the System.Net.Mime Namespace.
I have often thought it strange that there isn't a good/comprehensive single 'source of truth' for these constants (preferably in an updatable package) as part of the primary .net ecosystem. By primary I mean directly supported/published by Microsoft (or I guess DNF).
</:thought_balloon:>
Hello,
while using the StaticFilesMiddleware I noticed that the ".json" extension is not known in the FileExtensionContentTypeProvider, thus JSON files are not delivered if "ServeUnknownFileTypes" is set to false.
Is this a similar oversight like how old versions of IIS (IIRC Windows Server 2008 R2) did not serve .json files by default, while newer versions (IIRC Windows Server 2013) do so, or did you leave that file type out for a good reason?
Kind regards,
Alexander
The text was updated successfully, but these errors were encountered: