git - Azure Web应用程序在进行本地git部署时自动创建web.config,破坏应用程序(添加不需要的设置)

标签 git azure azure-web-app-service

我有一个简单的 HTML/JS/CSS 项目(不是 Node)。我创建了一个全新的 Azure Web 应用程序,并将其部署选项设置为“本地 git”。然后我按照有关 Local Git Deployment to Azure 的说明进行操作,运行git remote add azure https://<my-user-name>@localgitreprosite.scm.azurewebsites.net:443/LocalGitReproSite.git >。我推送到存储库 ( git push azure master )

问题是 Azure(或更具体地说,执行 git 推送时运行的部署引擎)看到我的文件名为“app.js”,并假设它是节点部署。然后它会生成一个 web.config。您可以在日志中看到它:

remote: Handling node.js deployment.
remote: KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
remote: Deleting file: 'hostingstart.html'
remote: Copying file: '.gitignore'
<... remote: Copying file>
remote: Looking for app.js/server.js under site root.
remote: Using start-up script app.js
remote: Generated web.config.
remote: The package.json file does not specify node.js engine version constraints.
remote: The node.js application will run with the default node.js version 6.9.1.
remote: Selected npm version 3.10.8
<... etc>

当出现这种情况时,网站会返回 500 错误,因为 web.config添加 iisnode处理程序和一堆其他不需要的东西,这与简单的 html/js/css 资源无关。

我怎样才能抑制这个web-config -创建行为(或者更广泛地说,自动猜测我正在做的项目),并使部署按原样工作?我可以通过门户或 .deployment 文件进行配置来告诉 Azure 不要猜测吗?

我的项目结构非常简单:

enter image description here

我意识到“app.js”是一种常见的节点模式,但它也是一种相当常见的单页应用程序模式。因此,虽然我确实可以将“app.js”的名称更改为其他名称,但我宁愿没有这种人为限制......

谢谢!

最佳答案

尝试设置此应用程序设置SCM_SCRIPT_GENERATOR_ARGS=--basic。请参阅wiki了解详情。

您可能需要手动删除已部署应用程序上的web.config

如果您想完全控制部署过程,您可以转而使用 custom deployment script ,它可以让您控制发生的一切。

关于git - Azure Web应用程序在进行本地git部署时自动创建web.config,破坏应用程序(添加不需要的设置),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42425982/

相关文章:

git - Visual Studio Code SSH 推和 pull 可以在命令行中工作,但不能使用推和 pull 按钮

首次加载时显示的 Azure AD B2C 自定义 UI 错误标签

azure - 无法在Windows操作系统下的Azure中创建新的.NET Core 3.1 Web应用程序

Azure 网站删除自定义 header

git - 忽略特定存储库的全局 gitignore 规则

git - 使用 ssh key 与 Chef checkout git repo

azure - 将管道从一个 ADF 克隆到另一个 ADF

Azure CosmosDB 存储过程将函数参数更改为较小的大小写

c# - Azure WebService 找不到我的程序集之一,但它基于 Azure 控制台

git - 使用仍在审查中的 Cherry pick 推送代码以供审查的工作流