我应该在我的项目中添加web.config文件在哪里?

时间:2018-03-22 15:03:15

标签: json angular azure

我可以从我的应用程序的内容中了解到,Azure不会读取本地.json文件,因为我缺少文件调用web.config以默认生成MIME类型.json,因此它可以找到文件,它不会给我一个404错误。但是我在Root中添加了这个文件,但它似乎仍无法正常工作。我是在错误的目录中添加文件还是这不是解决问题的方法?

place where is hold the web.config file

- 的修改 -

这是我的web.config文件

    <webSocket enabled="false" />
<handlers>
  <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
  <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
  <rules>
    <!-- Do not interfere with requests for node-inspector debugging -->
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^server.js\/debug[\/]?" />
    </rule>

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

1 个答案:

答案 0 :(得分:1)

web.config文件位于您网站的根目录中。例如,如果您在&#34; Sample&#34; 文件夹中发布网站,则默认情况下会在\ Sample \目录中创建web.config。

所以web.config的位置是\ Sample \ web.config