什么web.config设置将允许提供apple-app-site-association?

Tod*_*her 9 iis web-config apple-app-site-associate

我已将apple-app-site-association文件添加到网站的根目录,但IIS未提供该文件.

在没有文件扩展名的情况下,使服务器提供此特定文件的最佳方法是什么?web.config中有没有办法明确说"提供此文件"?

mog*_*oli 20

我遇到了同样的问题,发现了这个惊人的帖子:

从IIS IIS 提供apple-app-site-association仅提供由其文件扩展名定义的已知类型的文件.由于apple-app-site-association不包含文件扩展名,因此当我尝试使用浏览器打开它时,IIS会引发404错误.我通过在web.config文件中添加mimeMap来修复此问题:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <!-- required for apple-app-site-association: -->
      <mimeMap fileExtension="." mimeType="application/json" />
    </staticContent>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

  • 最好将此 `system.webServer` 节点放在 `&lt;location path="apple-app-site-association"&gt;` 节点下,以将其限制为仅限于此文件,并避免提供任何其他无扩展名的文件。 (2认同)