Forum Discussion

samuelferreira323's avatar
samuelferreira323
Copper Contributor
Mar 22, 2023

'appcmd.exe' exited with code '1168' - release error

I'm trying to release my app on Azure DevOps but it is giving me this error on the "IIS Web App Manage" task:
  - Cannot find SITE object with identifier "SITE". 'appcmd.exe' exited with code '1168'.
 

It is being released to 3 different servers ate the same time and in the other 2 servers it works.

Since the last release I made, I didn't change anything in the server.

 

I tried to restart the application pool, restart the server, and to release the old version of the application but it also failed.

1 Reply

  • May try this:

     

    1. Verify the Site Exists
    On the failing server:
    •    Open Command Prompt as Administrator.
    •    Run: 

    %windir%\system32\inetsrv\appcmd list site


    •    Confirm that the site name matches exactly what your pipeline is referencing.
    If it’s missing, you’ll need to create it manually or adjust your pipeline to skip that server.

    2. Check for Typos or Case Sensitivity
    •    IIS site names are case-sensitive in some contexts.
    •    Make sure the name in your pipeline task matches the actual site name exactly.

    3. Inspect the IIS Configuration
    •    Open IIS Manager on the failing server.
    •    Look for the site manually.
    •    If it’s there, try stopping and starting it to confirm it’s responsive.

    4. Agent Permissions
    •    Ensure the Azure DevOps agent running on that server has admin rights.
    •    It needs permission to run appcmd.exe and manage IIS.

    5. Use a Conditional Task or Script
    If the site might not exist on all servers, consider using a PowerShell script with a conditional check:

    $siteName = "YourSiteName"
    $site = Get-WebSite -Name $siteName -ErrorAction SilentlyContinue
    if ($site) {
        # Proceed with deployment
    } else {
        Write-Host "Site $siteName not found. Skipping..."
    }

     

Resources