Search code examples
azureazure-web-app-serviceaz

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


I have created an Asp.NET web application using Visual studio 2019 >> i publish the project to my c drive >> zip the generated files. then i wanted to deploy it to Azure web app >> i open azure command line >> i run this command:-

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"

But i got these exceptions:-

Getting scm site credentials for zip deployment The command failed with an unexpected error. Here is the traceback:

[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'

Solution

  • There is a tiny error in your command. For --src " C:\pus\bin.zip", there is a redundant white-space in

    " C:\pus\bin.zip". Just remove the white-space, and it will work.

    so the correct command should be:

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

    The screenshot of my test:

    enter image description here