如何使部署的Web应用程序找到我的静态文件?

时间:2020-05-02 23:51:18

标签: reactjs azure web-deployment

我有一个简单的react应用,其中包含一些链接和带有视频背景的登录页面。 我已经运行了一个npm构建来为我已部署在Azure上的Web应用程序创建构建文件夹。一切正常,但我的视频背景没有出现。我的其他图像和图标也可以。

我在找不到资源manifest.json和我的静态文件夹时遇到错误。我已经在Azure中检查了这些文件是否存在,并且确实存在。

Errors im getting in browser

这是我的web.config。 `

 https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config

->

    <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
    <rule name="StaticContent">
      <action type="Rewrite" url="public{PATH_INFO}"/>
    </rule>

    <!-- All other URLs are mapped to the node.js site entry point -->
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
      </conditions>
      <action type="Rewrite" url="server.js"/>
    </rule>
  </rules>
</rewrite>

<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
  <requestFiltering>
    <hiddenSegments>
      <remove segment="bin"/>
    </hiddenSegments>
  </requestFiltering>
</security>

<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />

<!--
  You can control how Node is hosted within IIS using the following options:
    * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
    * node_env: will be propagated to node as NODE_ENV environment variable
    * debuggingEnabled - controls whether the built-in debugger is enabled

  See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
<staticContent>
    <remove fileExtension=".mp4" />
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        <remove fileExtension=".json" />
        <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

`

对不起,如果我的表现不好,我是天青了

0 个答案:

没有答案