如何使用Azure DevOps部署create-react-app?

cor*_*san 6 azure azure-web-sites azure-web-app-service azure-devops create-react-app

我花了过去两天的时间来弄清楚如何使用Azure DevOps部署我的Web应用程序,但没有任何结果。我使用FileZila来查看构建生成的文件是否正在上载,并且所有文件都在该wwwroot文件夹下。我也尝试使用FileZilla手动上传文件。在这一点上,我真的很沮丧,因为我已经尝试了所有在网上找到的东西来部署该应用程序。DevOps可以很好地工作,不能正常工作的部分是我访问URL时实际上显示了我的Web应用程序。

我遵循了所有可以找到的教程。

这是我尝试访问我的网站时看到的

不知道为什么在清楚部署代码后为什么要我部署代码:/

Jay*_*ong 1

未能重现您的问题,您可以按照我的操作步骤进行操作,如下:

1.导入存储库,我使用了此文档中的git url :https://github.com/MicrosoftDocs/pipelines-javascript

在此输入图像描述

2.创建构建管道。

在此输入图像描述

3.运行构建过程。

在此输入图像描述

4.发布项目并选择Nodejs Web APP。

在此输入图像描述

5.在订阅中选择 azure Web 应用服务。

在此输入图像描述

6.导航到您的项目 URL。

在此输入图像描述

7.我的文件在/wwwroot目录下。

在此输入图像描述

web.config归档如下:

<?xml version="1.0" encoding="utf-8"?>
<!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express.  For more information, visit:

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

<configuration>
  <system.webServer>
    <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
    <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"/>-->
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

您可以检查您的步骤和我的步骤之间的任何差异。如有任何疑问,请告诉我。