node.js - IIS 10 - 即使在配置 MIME 和处理程序之后,JSON 文件也无法提供服务
问题描述
我已经在从 Node.js 构建的 IIS 10 (Windows 10) 中部署了一个 Web 应用程序。
文件结构
我无法使用直接 URL 访问 JSON 文件(例如http://localhost:3000/manifest.json )。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Static Assets" stopProcessing="true">
<match url="([\S]+[.](html|htm|svg|js|css|png|gif|jpg|jpeg|json))" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="ReactRouter Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
<handlers>
<add name="StaticFileModuleJson" path="*.json*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
</handlers>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
解决方案
推荐阅读
- java - 如何使用 Java 更改 MySQL 列大小?
- c - 代码强制运行时错误(退出代码为 -1073741819)
- reactjs - React Native 和 ContextApi 的 Typescript 错误
- flutter - Flutter - ListView.builder 呈现小部件但不可滚动
- admob - AdMob 广告显示黑色广告但可点击
- php - 订单未显示在客户帐户页面的“订单”选项卡中
- python - Google Colab 中的代码格式化,如 Jupyter 的 autopep8 或 black
- bash - 如何在bash中迭代两个数组中的元素组合?
- python-3.x - Kivy recycleview 按钮在窗口调整大小时切换属性
- gradle - Gradle 错误地确定 Jar 任务 UP-TO-DATE