【问题标题】:Azure Web App (MVC 6) continuous deployment failsAzure Web App (MVC 6) 持续部署失败
【发布时间】:2016-03-25 20:18:58
【问题描述】:

我正在尝试为来自 Bitbucket 的 Azure Web 应用程序设置连续部署。然而,部署失败并出现以下错误:

Command: deploy.cmd
Handling ASP.NET 5 Web Application deployment.
Invoke-Command : Cannot validate argument on parameter 'Architecture'. The 
argument "undefined" does not belong to the set ",x86,x64,arm" specified by 
the ValidateSet attribute. Supply an argument that is in the set and then try 
the command again.
At C:\Program Files 
(x86)\SiteExtensions\Kudu\49.41216.1976\bin\scripts\dnvm.ps1:1914 char:9
+         Invoke-Command ([ScriptBlock]::Create("dnvm-$cmd $cmdargs"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power   
Failed exitCode=1, command=PowerShell -NoProfile -NoLogo -ExecutionPolicy
unrestricted -Command "
[System.Threading.Thread]::CurrentThread.CurrentCulture = '';
[System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='"D:\local\UserProfile\.dnx\temp-set-envvars.cmd"';&
'C:\Program Files (x86)\SiteExtensions\Kudu\49.41216.1976\bin\scripts\dnvm.ps1' " install undefined -arch undefined -r undefined
Shell.Commands.InvokeCommandCommand

An error has occurred during web site deployment.

直接从 Visual Studio 2015 发布/部署工作没有任何问题。似乎 dnvm.ps1 命令传递了一堆导致此错误的“未定义”参数。通过运行在本地创建部署脚本 (as instructed here)

azure site deploymentscript --aspNet5 <path to the project.json file>

还将生成具有相同“未定义”变量的 deploy.cmd。

我没有使用任何自定义部署脚本,我的 global.json 看起来像:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-rc1-update1"
  }
}

【问题讨论】:

  • 我们从 BitBucket 部署没有问题。您的存储库是否包含任何部署脚本,或者您是否让它自动生成?您是否使用 global.json 文件来定义您使用的框架版本?
  • 我在上面的问题中添加了我的 global.json。我没有使用任何自定义部署脚本。感谢您的帮助!

标签: asp.net asp.net-mvc azure asp.net-core asp.net-core-mvc


【解决方案1】:

出现问题是因为我运行了在本地生成 deploy.cmd 文件的 azure site deploymentscript --aspNet5 &lt;path to the project.json file&gt;。然后,如果该文件存在,Azure 部署将使用该文件。由于a bug in the generator,本地 deploy.cmd 具有未定义的参数。删除 deploy.cmd 解决了这个问题。

【讨论】:

    【解决方案2】:

    我最终不得不在重新运行部署脚本生成器时明确指定这些作为参数。

    azure site deploymentscript --aspNet5 sr\[myprojectfolder]\ --aspNet5Version 1.0.0-rc1-update1 --aspNet5Architecture x64 --aspNet5Runtime CLR

    按照 automatonic 的建议首先在 global.json 中指定它们然后重新运行没有任何效果,我认为这是一个错误。

    【讨论】:

      【解决方案3】:

      您的 global.json 文件可以定义 runtimearchitecture

      {
        "projects": [ "src", "test" ],
        "sdk": {
          "version": "1.0.0-rc1-update1",
          "runtime": "clr",
          "architecture": "x64"
        }
      }
      

      我猜脚本是从这些值中提取的,不知道如何处理它们从 global.json 中丢失?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-27
        • 1970-01-01
        • 1970-01-01
        • 2023-02-06
        • 1970-01-01
        相关资源
        最近更新 更多