Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Azure中的Express NodeJS web.config for SVG&;字体_Node.js_Azure_Svg_Web Config_Mime Types - Fatal编程技术网

Node.js Azure中的Express NodeJS web.config for SVG&;字体

Node.js Azure中的Express NodeJS web.config for SVG&;字体,node.js,azure,svg,web-config,mime-types,Node.js,Azure,Svg,Web Config,Mime Types,我在一个Express网站上遇到了一个问题,该网站使用SVG和字体等其他文件 在本地运行应用程序时没有任何问题,但一旦部署到Azure上,SVG和字体就不再出现 在项目根目录下创建了web.config文件: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <staticContent> <mimeMa

我在一个Express网站上遇到了一个问题,该网站使用SVG和字体等其他文件

在本地运行应用程序时没有任何问题,但一旦部署到Azure上,SVG和字体就不再出现

在项目根目录下创建了
web.config
文件:

<?xml version="1.0" encoding="utf-8"?>
  <configuration>
    <system.webServer>

      <staticContent>
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
        <mimeMap fileExtension=".ttf" mimeType="application/x-woff" />
      </staticContent>

    </system.webServer>
  </configuration>

还使用了此解决方案:()

这两种解决方案现在都允许加载SVG文件,但不再加载网页。(HTTP 500)

它似乎覆盖了动态内容的配置

如何配置动态内容以使应用程序再次工作?

我发现了问题

使用此解决方案:()

动态内容重写规则中,将
server.js
替换为
app.js
,这是Express创建的默认入口点

最终结果是:

<?xml version="1.0" encoding="utf-8"?>
  <configuration>
    <system.webServer>

      <staticContent>
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
        <mimeMap fileExtension=".ttf" mimeType="application/x-woff" />
      </staticContent>

      <handlers>
        <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
      </handlers>

      <rewrite>
        <rules>
          <rule name="DynamicContent">
            <match url="/*" />
            <action type="Rewrite" url="app.js" />
          </rule>
        </rules>
      </rewrite>

    </system.webServer>
  </configuration>

说真的,谢谢。我在这方面没有得到Azure支持的帮助。