-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add a Mime Type for .exe and .dll files. #21805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Useful for serving downloads of installers. Could be application/octet-stream, but I hear application/vnd.microsoft.portable-executable is specified by IANA here: https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable
aspnetcore/src/Middleware/StaticFiles/src/FileExtensionContentTypeProvider.cs Lines 14 to 17 in 595f11b
|
I'm guessing a lot of people publish installers, downloaders, setup.exe etc. It is a bit counter-intuitive that this doesn't work out of the box. |
Historically IIS didn't include these because the static files directory and your app directory were the same, it didn't want to expose your app assemblies as static files. That's less of an issue in AspNetCore since we separate out static content to a subdirectory in the default layout.
I buy that for exes, but what about dlls? |
Yes, I can image .dll download is not such a common scenario. |
@shirhatti we should consider adding exe's as they are quite common. |
For my own curiosity, what are the concerns with adding mime types to this list? From my naive perspective this should be pretty much benign? |
The list is already enormous and likely causing some performance issues. We also get very frequent requests to add new entries so we tried to establish clear criteria. |
Performance issues should be an orthogonal concern from delivering a good default experience to our users. If the performance is inadequate, let's prove it, let's measure it and let's fix it. I don't believe having more extensions in that dictionary should affect performance in any way if we do it right. This raises questions: why is this dictionary created as an instance every time we create the class? Why isn't there a shared static Dictionary somewhere that this falls back to? I honestly would optimize for the principle of least surprise: as a user, I just want to serve some static files. I shouldn't be thinking about Mime types, IIS, or some legacy reasons. My out of the box experience is that I serve a file, of any IANA supported extension, and it just magically works out of the box, no assembly required. Thanks! |
Fair, the performance comment was lazy on my part, I don't have the data handy to prove that.
There's commonly only one instance of this class an application anyways. Let me clarify the other comment. We get very frequent requests for additions to this list and many of them are for esoteric extensions that do not have broad usage or well defined standards. Adding such content provides little value, we'd rather those developers edit their own list locally. |
OK understood. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Triage: We should add exe support, but we don't plan on adding dll support.
I do want to try this and see how browsers handle that "application/vnd.microsoft.portable-executable" content-type.
src/Middleware/StaticFiles/src/FileExtensionContentTypeProvider.cs
Outdated
Show resolved
Hide resolved
src/Middleware/StaticFiles/src/FileExtensionContentTypeProvider.cs
Outdated
Show resolved
Hide resolved
…r.cs Co-authored-by: Chris Ross <[email protected]>
…r.cs Co-authored-by: Chris Ross <[email protected]>
Hello @Tratcher! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Thanks |
Useful for serving downloads of installers.
Could be application/octet-stream, but I hear application/vnd.microsoft.portable-executable is specified by IANA here:
https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable