开发者

How does SimpleWorkerRequest associate MIME types with extensions?

开发者 https://www.devze.com 2022-12-26 04:06 出处:网络
I was serving html referencing svg files in Cassini, and having problems since the mime type was not being sent properly. I ended up writing my own port of Cassini that set the extension based on mime

I was serving html referencing svg files in Cassini, and having problems since the mime type was not being sent properly. I ended up writing my own port of Cassini that set the extension based on mime type.

After a good night of sleep开发者_StackOverflow I realized that there might be some sort of registry key or config file where I can configure custom mime types for SimpleWorkerRequest, the .NET class that serves content through Casinni. However, I don't know what that is.


I'm fairly certain you'll have to be responsible for identifying and then sending the proper MIME types via the response headers using SimpleWorkerRequest.SendKnownResponseHeader.

A basic implementation and discussion of this can be found on this blog post.

Now if you'd like to reimplement IIS' list of MIME types, IIS stores its own list in the metabase (and subsequent XML). A previous stackoverflow question highlights how to access that list and where to pull it from.


If you don't want to re-implement, or just want to copy the list, there is a list of mime types included with the default installation of the Neokernel Web Server (http://www.neokernel.com) and the server can be easily configured to support different or custom mime types by updating the list.

0

精彩评论

暂无评论...
验证码 换一张
取 消