简体   繁体   中英

IIS - Windows Server 2012 R2 - File Permission Forbidden Extension [web.config]

I am attempting to view a URL on my web page that contains an unusual extension. http://example.com/folder/file.xyz but it will not show. It displays a 404 error is there something I've done wrong here? Do I need to use a web.config file? Should I setup some sort of security setting?

For this unusual (.xyz) extension you need to do MIME type entry in web.config file as follows so that IIS allows this file extension.

<configuration>
  <system.webServer>
    <staticContent>
        <mimeMap fileExtension=".xyz" mimeType="application/text" />
    </staticContent>
   </system.webServer>
</configuration>

Note : You need to change "mimeType" value in above configuration as per contents of file. eg application/xml or application/xml etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM