使用IIS将没有扩展名的文件作为纯文本提供

Dan*_*iel 6 iis web-config mime-types

我尝试过使用IIS的答案:如何在没有扩展名的情况下提供文件?

 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <system.webServer>
         <staticContent>
             <mimeMap fileExtension=".*" mimeType="text/plain" />
         </staticContent>
     </system.webServer>
 </configuration>
Run Code Online (Sandbox Code Playgroud)

哪个让我定位文件,但不能访问它

HTTP错误404.3 - 未找到

由于扩展配置,无法提供您请求的页面.如果页面是脚本,请添加处理程序.如果要下载文件,请添加MIME映射.

Pan*_*are 16

试试这个

<staticContent>
   <mimeMap fileExtension="." mimeType="text/html" />
</staticContent>
Run Code Online (Sandbox Code Playgroud)

  • 这有效,`fileExtension =""`也适用于FWIW (2认同)