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

问题描述 投票:4回答:1

我花了两天时间试图找出如何使用Azure DevOps部署我的Web应用程序,但没有显示任何内容。我使用FileZila来查看构建生成的文件是否正在上传,所有文件都在wwwroot文件夹下。我也尝试使用FileZilla手动上传文件。在这一点上,我真的很沮丧,因为我已经尝试了我在网上找到的所有部署应用程序。 DevOps工作得非常好,不起作用的部分是我的网页应用实际出现在我去网址时。

我按照了我能找到的所有教程。

This is what I see when I try to visit my site

在明确部署代码时,不知道为什么要求我部署代码:/

azure azure-devops azure-web-sites create-react-app azure-web-app-service
1个回答
2
投票

无法重现您的问题,您可以按照以下工作步骤操作:

1.Import repository,我使用了这个document的git url:https://github.com/MicrosoftDocs/pipelines-javascript

enter image description here

2.创建构建管道。

enter image description here

3.运行构建过程。

enter image description here

4.释放项目并选择Nodejs Web APP。

enter image description here

5.在订阅中选择azure web app服务。

enter image description here

6.导航到您的项目网址。

enter image description here

7.我的/ wwwroot目录中的文件。

enter image description here

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>

你可以检查你的步骤和我的步骤之间的任何差异。任何关注,请让我知道。

© www.soinside.com 2019 - 2024. All rights reserved.