There are often some special MIME types that are not in IIS and are generally added manually by ourselves. If the site frequently changes the server or the site code is provided to multiple users, it will cause the special MIME type used in the site to be regularly configured on IIS. Given the commonality of a Web site configuration, we can add MIME types to the ASP. NET site configuration file so that users don't have to configure IIS all the time.
In general, we are configuring this part of the MIME information in the Staticcontent node of the system.webserver node, as long as the fileextension file extension attribute in the MimeMap node is set and MimeType this MIME type property (Click this link Common MIME types).
The approximate code is as follows (the extensions and MIME types added in the code are just examples):
<System.webserver><Staticcontent><Removefileextension=". Woff"/><Removefileextension=". xap"/><Removefileextension=". xaml"/><mimemap fileExtension=mimetype= "Font/x-font-woff"/ > <mimemap fileExtension=< Span class= "Hljs-value" ". xap" mimetype= "xapapplication/ X-silverlight "/> <mimemap Fileextension=mimetype=</staticcontent> </SYSTEM.WEBSERVER>
You can see that there are 3 extensions that are not available by default in IIS:
- . Woff (Woff font)
- . XAP (Silverlight compiled file)
- . xaml (Extensible Application Markup Language, extensible Application Markup Language)
It is important to note that in the above code I have also declared remove, which removes the node, in order to prevent this exception from being added to the Web site by repeating the addition of the MIME type: "The unique key property" FileExtension "cannot be added when the". Woff "is set to" MimeMap "Duplicate collection items", if your site does not prompt this exception information, or can be determined that the user's IIS must not be configured on these extensions, then the Remove node can not be added.
How to add MIME types to the Web. config configuration file in ASP.