将我的 Visual Studio 项目 zip 文件部署到 azure "The command failed with an unexpected error. Here is the traceback:" 时出错

Error when deploying my Visual Studio project zip file to azure "The command failed with an unexpected error. Here is the traceback:"

我使用 Visual studio 2019 创建了一个 Asp.NET 网络应用程序 >> 我将项目发布到我的 C 盘 >> 压缩生成的文件。然后我想将它部署到 Azure 网络应用 >> 我打开 azure 命令行 >> 我 运行 这个命令:-

C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9>az webapp deployment source config-zip --resource-group "PUS" --name "TGPUS" --src " C:\pus\bin.zip"

但我遇到了这些例外情况:-

获取用于 zip 部署的 scm 站点凭据 命令因意外错误而失败。这是回溯:

[Errno 22] Invalid argument: 'C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\ C:\pus\bin.zip'
Traceback (most recent call last):
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\knack\knack\cli.py", line 206, in invoke
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 608, in execute
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 666, in _run_jobs_serially
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 659, in _run_job
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\six\six.py", line 696, in reraise
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_job
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\__init__.py", line 493, in default_command_handler
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli\azure\cli\command_modules\appservice\custom.py", line 344, in enable_zip_deploy_webapp
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli\azure\cli\command_modules\appservice\custom.py", line 369, in enable_zip_deploy
OSError: [Errno 22] Invalid argument: 'C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\ C:\pus\bin.zip'

To open an issue, please run: 'az feedback'

您的命令有一个小错误。对于--src " C:\pus\bin.zip"

中多了一个white-space

" C:\pus\bin.zip"。只需删除 white-space 即可。

所以正确的命令应该是:

az webapp deployment source config-zip --resource-group "PUS" --name "TGPUS" --src "C:\pus\bin.zip"

我的测试截图: