Json 我应该在项目中的何处添加web.config文件?
我能从我的应用程序中了解到的是,Azure没有读取本地的.json文件,因为我缺少一个文件调用web.config,默认情况下创建MIME类型.json,这样它就可以找到文件,并且不会抛出404错误。但是我在根目录中添加了这个文件,但它似乎仍然不起作用。我是否将文件添加到错误的目录中,或者这不是解决问题的方法 --编辑-- 这是我的web.config文件Json 我应该在项目中的何处添加web.config文件?,json,angular,azure,Json,Angular,Azure,我能从我的应用程序中了解到的是,Azure没有读取本地的.json文件,因为我缺少一个文件调用web.config,默认情况下创建MIME类型.json,这样它就可以找到文件,并且不会抛出404错误。但是我在根目录中添加了这个文件,但它似乎仍然不起作用。我是否将文件添加到错误的目录中,或者这不是解决问题的方法 --编辑-- 这是我的web.config文件 <webSocket enabled="false" /> <handlers> <!-- In
<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"/>-->
web.config文件位于网站的根目录中。例如,如果在“Sample”文件夹中发布网站,则默认情况下会在\Sample\目录中创建web.config
所以web.config的位置是\Sample\web.config我真的不明白。您是否正在Azure中部署angular应用程序?是的,web.config必须位于根目录下,但它必须位于部署应用程序其他文件的位置。是的,我正在Azure中部署我的Angular应用程序。是的,Web.config也在服务器上。是否使用“ng build”构建应用程序?您必须将这些文件放在服务器上(通常在wwwroot中),然后将您的web.config放在同一位置。您可以向我们展示您的web.config的内容吗?问题可能就在这里。您的web.config可能需要mime类型来提供JSON文件。看见