0

What I can understand from what is going on with my App is that Azure is not reading the local .json files because I am missing a file call web.config to make the MIME type .json by default so it can found the files and it doesn't throw me a 404 error. But I add this file in the Root but it still seems to not working. am I adding the file in the wrong directory or is that this is not the way to solve the problem?

place where is hold the web.config file

--Edit--

This is my web.config file

    <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"/>-->

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Reponic
  • 91
  • 1
  • 1
  • 8
  • I don't really understand. Are you deploying your angular application in Azure? web.config has to be at the root, yes, but it has to be where are deployed other files of the application. – Powkachu Mar 22 '18 at 15:16
  • Yes I am deploying my Angular App in Azure. yes the Web.config is on the server also – Reponic Mar 22 '18 at 15:17
  • Are you building your app with 'ng build'? You have to put these files on the server (in wwwroot normally) and then put your web.config at the same place. – Powkachu Mar 22 '18 at 15:21
  • Can you show us the content of your web.config? Maybe the problem is here. – Powkachu Mar 22 '18 at 15:21
  • Your web.config probably needs a mime type for serving JSON files. See [this post](https://stackoverflow.com/questions/17626776/why-is-my-json-file-not-found/35405186#35405186) – rickvdbosch Mar 22 '18 at 15:28
  • I already edit the wuestion with the web.config file and I dont see any folder called wwwroot in the Azure site – Reponic Mar 22 '18 at 15:39

1 Answers1

1

web.config file is located in root directory of your website. for example if you publish a website in "Sample" folder, then web.config is created in \Sample\ directory by default.

so location of web.config is \Sample\web.config

Hasan Nafisi
  • 138
  • 6