Home > Back-end >  App Service web app showing file structure instead of actual web apge
App Service web app showing file structure instead of actual web apge

Time:12-13

Today i've deployed my client react app to Azure App Service. The problem is, that instead of displaying site im interested in, it returns structure of wwwroot. Even if I change directory to /src/App.js it return code of the App. What is the problem?

enter image description here

CodePudding user response:

When you run a node application on Windows Azure Web Apps, IIS is used as the webserver together with iisnode and most likely some configuration is wrong so IIS doesn't know what to start. I'd suggest to let Azure handle the creation of the web.config and you don't touch it unless you know what you're doing:

  1. Create a file .deployment with the following content

    [config]
    SCM_DO_BUILD_DURING_DEPLOYMENT = true
    
  2. Put the .deployment file as well as the content of your React app (don't include web.config, you also don't have to include the node_modules folder, Azure will handle this as SCM_DO_BUILD_DURING_DEPLOYMENT is set to true) into an upload.zip file.

  3. Delete the content of /wwwroot in Azure

  4. Run az webapp deployment source config-zip -g <ResourceGroupName> -n <AppServiceName> --src upload.zip

A new web.config should get created which should contain a handler for server.js which will be the file to be served by Node.js.

CodePudding user response:

This is solved. Thanks to @azium

The only thing i needed to do is run 'npm run build' in local before deployment

  • Related