简体   繁体   English

web.config 通过 FTP 运行部署在 azure 应用服务上的 dist 文件夹

[英]web.config to run dist folder deployed on azure app service via FTP

I am using Vue CLI project and wants to deploy the dist folder to Azure App Service via FTP but I am missing with web.config file to run my deployed app service.我正在使用 Vue CLI 项目并希望通过 FTP 将 dist 文件夹部署到 Azure 应用服务,但我缺少 web.config 文件来运行我部署的 app 服务。

I am trying to do this answer but can't find a web.config file for my reference.我正在尝试回答这个问题,但找不到 web.config 文件供我参考。

Thanks in advance for your answers.提前感谢您的回答。

FTP deployment doesn't support build automation like: FTP 部署不支持构建自动化,例如:

  • generation of web.config一代web.config
  • dependency restores (such as NuGet, NPM, PIP, and Composer automations)依赖关系恢复(例如 NuGet、NPM、PIP 和 Composer 自动化)
  • compilation of .NET binaries .NET 二进制文件的编译

Generate these necessary files manually on your local machine, and then deploy them together with your app.在本地机器上手动生成这些必要的文件,然后将它们与您的应用程序一起部署。

  • Add web.config file with a URL Rewrite rule使用 URL 重写规则添加 web.config 文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Handle History Mode and custom 404/500" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
  • Vue CLI generated projects are configured to copy anything in the public folder directly into the build output directory (dist by default). Vue CLI 生成的项目配置为将 public 文件夹中的任何内容直接复制到 build output 目录(默认为 dist)。
  • Put it in /public It will then be copied over to /dist during build.将它放在 /public 中,然后在构建期间将它复制到 /dist。
  • I have created the config file in public folder, After running npm run build , web.config file is copied to dist folder.我在 public 文件夹中创建了配置文件,运行npm run build后,web.config 文件被复制到 dist 文件夹。

在此处输入图像描述

  • To create web.config,Right click on the public folder-->Add new file, name it as web.创建web.config,在公用文件夹上右键-->添加新文件,命名为web。 Config and add the above mentioned code snippet and save.配置并添加上述代码片段并保存。
  • Go to Azure portal, your Web App =>Advanced Tools=>KUDU - Debug Console =>CMD => site=>wwwroot, check if web.config file exists or not. Go to Azure portal, your Web App =>Advanced Tools=>KUDU - Debug Console =>CMD => site=>wwwroot, check if web.config file exists or not.

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM