PSRemotingTransportException при использовании WinRM - развертывание веб-приложений IIS

Я настроил WinRM.

Я получаю ответ ниже после запуска winrm quickconfig, поскольку служба winrm уже запущена.

WinRM service is already running on this machine.

WinRM is already set up for remote management on this computer.

Кроме того, если я сделаю New-PSSession -ComputerName DESKTOP-0DNHIDE

Я получаю результат ниже

 Id Name            ComputerName    ComputerType    State         ConfigurationName     Availability
 -- ----            ------------    ------------    -----         -----------------     ------------
  5 WinRM5          DESKTOP-0DNHIDE RemoteMachine   Opened        Microsoft.PowerShell     Available

Я также могу установить PSConnection, используя

`Enter-PSSession -Computername DESKTOP-0DNHIDE`

Но все же, когда я пытаюсь развернуть приложение CSharp с помощью Azure Devops Pipeline, получаю ошибку ниже

[error]Microsoft.PowerShell.Commands.WriteErrorException: Deployment on one or more machines failed. System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server xx.xx.xx.xx failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.

Я использую задачу WinRM - развертывание веб-приложений IIS в конвейере azure DevOps для развертывания приложения CSharp на локальном сервере IIS.

Агент AzureDevops настроен для моего локального компьютера.

Полный журнал из конвейера выпуска приведен ниже:

2019-07-19T02:58:20.7948043Z ##[debug]Evaluating condition for step: 'Manage IISWebsite'
2019-07-19T02:58:20.7950382Z ##[debug]Evaluating: succeeded()
2019-07-19T02:58:20.7950615Z ##[debug]Evaluating succeeded:
2019-07-19T02:58:20.7951602Z ##[debug]=> True
2019-07-19T02:58:20.7952146Z ##[debug]Result: True
2019-07-19T02:58:20.7952671Z ##[section]Starting: Manage IISWebsite
2019-07-19T02:58:20.8496506Z ==============================================================================
2019-07-19T02:58:20.8496698Z Task         : WinRM - IIS Web App Management
2019-07-19T02:58:20.8496768Z Description  : Connect via WinRM, to create or update a Website, Web App, Virtual Directories, and Application Pool locally on IIS
2019-07-19T02:58:20.8496827Z Version      : 2.1.0
2019-07-19T02:58:20.8496861Z Author       : Microsoft Corporation
2019-07-19T02:58:20.8496895Z Help         : [More Information](http://aka.ms/IISMgmt)
2019-07-19T02:58:20.8496934Z ==============================================================================
2019-07-19T02:58:20.8798461Z Preparing task execution handler.
2019-07-19T02:58:21.7605314Z Executing the powershell script: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\Main.ps1
2019-07-19T02:58:21.7606356Z ##[debug]PowerShellHandler.Execute - AddCommand(E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\Main.ps1)
2019-07-19T02:58:21.7606607Z ##[debug]PowerShellHandler.Execute - Add inputParameters
2019-07-19T02:58:21.7606785Z ##[debug]PowerShellHandler.Execute - AddParameter(machinesList=localhost)
2019-07-19T02:58:21.7606939Z ##[debug]PowerShellHandler.Execute - AddParameter(AdminUserName=desktop-0dnhide\hp)
2019-07-19T02:58:21.7607111Z ##[debug]PowerShellHandler.Execute - AddParameter(AdminPassword=*******)
2019-07-19T02:58:21.7607282Z ##[debug]PowerShellHandler.Execute - AddParameter(WinRMProtocol=Https)
2019-07-19T02:58:21.7607481Z ##[debug]PowerShellHandler.Execute - AddParameter(TestCertificate=true)
2019-07-19T02:58:21.7607679Z ##[debug]PowerShellHandler.Execute - AddParameter(IISDeploymentType=IISWebsite)
2019-07-19T02:58:21.7607883Z ##[debug]PowerShellHandler.Execute - AddParameter(ActionIISWebsite=CreateOrUpdateWebsite)
2019-07-19T02:58:21.7607995Z ##[debug]PowerShellHandler.Execute - AddParameter(ActionIISApplicationPool=CreateOrUpdateAppPool)
2019-07-19T02:58:21.7608086Z ##[debug]PowerShellHandler.Execute - AddParameter(StartStopWebsiteName=)
2019-07-19T02:58:21.7608180Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteName=POC)
2019-07-19T02:58:21.7608260Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsitePhysicalPath=D:\PublishApplication\POC\)
2019-07-19T02:58:21.7608349Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsitePhysicalPathAuth=WebsiteUserPassThrough)
2019-07-19T02:58:21.7608429Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteAuthUserName=)
2019-07-19T02:58:21.7608517Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteAuthUserPassword=)
2019-07-19T02:58:21.7608597Z ##[debug]PowerShellHandler.Execute - AddParameter(AddBinding=true)
2019-07-19T02:58:21.7608699Z ##[debug]PowerShellHandler.Execute - AddParameter(CreateOrUpdateAppPoolForWebsite=true)
2019-07-19T02:58:21.7608783Z ##[debug]PowerShellHandler.Execute - AddParameter(ConfigureAuthenticationForWebsite=false)
2019-07-19T02:58:21.7608870Z ##[debug]PowerShellHandler.Execute - AddParameter(Protocol=http)
2019-07-19T02:58:21.7609293Z ##[debug]PowerShellHandler.Execute - AddParameter(IPAddress=All Unassigned)
2019-07-19T02:58:21.7609385Z ##[debug]PowerShellHandler.Execute - AddParameter(Port=8086)
2019-07-19T02:58:21.7609468Z ##[debug]PowerShellHandler.Execute - AddParameter(ServerNameIndication=false)
2019-07-19T02:58:21.7609548Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithOutSNI=)
2019-07-19T02:58:21.7609638Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithHttp=)
2019-07-19T02:58:21.7609718Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithSNI=)
2019-07-19T02:58:21.7611169Z ##[debug]PowerShellHandler.Execute - AddParameter(SSLCertThumbPrint=)
2019-07-19T02:58:21.7611253Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolNameForWebsite=POC-Pool)
2019-07-19T02:58:21.7611341Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersionForWebsite=v4.0)
2019-07-19T02:58:21.7611423Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineModeForWebsite=Integrated)
2019-07-19T02:58:21.7611526Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentityForWebsite=ApplicationPoolIdentity)
2019-07-19T02:58:21.7611607Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsernameForWebsite=)
2019-07-19T02:58:21.7611686Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPasswordForWebsite=)
2019-07-19T02:58:21.7611774Z ##[debug]PowerShellHandler.Execute - AddParameter(AnonymousAuthenticationForWebsite=false)
2019-07-19T02:58:21.7611852Z ##[debug]PowerShellHandler.Execute - AddParameter(BasicAuthenticationForWebsite=false)
2019-07-19T02:58:21.7611951Z ##[debug]PowerShellHandler.Execute - AddParameter(WindowsAuthenticationForWebsite=true)
2019-07-19T02:58:21.7612029Z ##[debug]PowerShellHandler.Execute - AddParameter(ParentWebsiteNameForVD=)
2019-07-19T02:58:21.7612117Z ##[debug]PowerShellHandler.Execute - AddParameter(VirtualPathForVD=)
2019-07-19T02:58:21.7612198Z ##[debug]PowerShellHandler.Execute - AddParameter(PhysicalPathForVD=%SystemDrive%\inetpub\wwwroot)
2019-07-19T02:58:21.7612293Z ##[debug]PowerShellHandler.Execute - AddParameter(VDPhysicalPathAuth=VDUserPassThrough)
2019-07-19T02:58:21.7612372Z ##[debug]PowerShellHandler.Execute - AddParameter(VDAuthUserName=)
2019-07-19T02:58:21.7612456Z ##[debug]PowerShellHandler.Execute - AddParameter(VDAuthUserPassword=)
2019-07-19T02:58:21.7612535Z ##[debug]PowerShellHandler.Execute - AddParameter(ParentWebsiteNameForApplication=)
2019-07-19T02:58:21.7612618Z ##[debug]PowerShellHandler.Execute - AddParameter(VirtualPathForApplication=)
2019-07-19T02:58:21.7612700Z ##[debug]PowerShellHandler.Execute - AddParameter(PhysicalPathForApplication=%SystemDrive%\inetpub\wwwroot)
2019-07-19T02:58:21.7612789Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationPhysicalPathAuth=ApplicationUserPassThrough)
2019-07-19T02:58:21.7612875Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationAuthUserName=)
2019-07-19T02:58:21.7612953Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationAuthUserPassword=)
2019-07-19T02:58:21.7613048Z ##[debug]PowerShellHandler.Execute - AddParameter(CreateOrUpdateAppPoolForApplication=false)
2019-07-19T02:58:21.7613128Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolNameForApplication=)
2019-07-19T02:58:21.7613214Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersionForApplication=v4.0)
2019-07-19T02:58:21.7613292Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineModeForApplication=Integrated)
2019-07-19T02:58:21.7613447Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentityForApplication=ApplicationPoolIdentity)
2019-07-19T02:58:21.7613540Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsernameForApplication=)
2019-07-19T02:58:21.7613628Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPasswordForApplication=)
2019-07-19T02:58:21.7613707Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolName=)
2019-07-19T02:58:21.7613795Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersion=v4.0)
2019-07-19T02:58:21.7614062Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineMode=Integrated)
2019-07-19T02:58:21.7614152Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentity=ApplicationPoolIdentity)
2019-07-19T02:58:21.7614233Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsername=)
2019-07-19T02:58:21.7614312Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPassword=)
2019-07-19T02:58:21.7614398Z ##[debug]PowerShellHandler.Execute - AddParameter(StartStopRecycleAppPoolName=)
2019-07-19T02:58:21.7614476Z ##[debug]PowerShellHandler.Execute - AddParameter(AppCmdCommands=)
2019-07-19T02:58:21.7615059Z ##[debug]PowerShellHandler.Execute - AddParameter(DeployInParallel=true)
2019-07-19T02:58:22.4170890Z ##[debug]PowerShellHandler.Execute - Invoke
2019-07-19T02:58:22.4171297Z ##[debug]Resetting input encoding.
2019-07-19T02:58:22.4172420Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\VstsTaskSdk.psd1'.
2019-07-19T02:58:22.4172731Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\VstsTaskSdk.psm1'.
2019-07-19T02:58:22.4280894Z ##[warning]VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts.
2019-07-19T02:58:22.4293211Z ##[debug]Processed: ##vso[task.logissue type=warning]VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts.
2019-07-19T02:58:22.4293844Z ##[debug]NonInteractive: False
2019-07-19T02:58:22.4294206Z ##[debug]Adding long path native methods.
2019-07-19T02:58:22.8215634Z ##[debug]Exporting function 'Find-Files'.
2019-07-19T02:58:22.8217695Z ##[debug]Exporting function 'Get-Endpoint'.
2019-07-19T02:58:22.8218463Z ##[debug]Exporting function 'Get-Input'.
2019-07-19T02:58:22.8218837Z ##[debug]Exporting function 'Get-TaskVariable'.
2019-07-19T02:58:22.8219129Z ##[debug]Exporting function 'Get-TaskVariableInfo'.
2019-07-19T02:58:22.8219320Z ##[debug]Exporting function 'Set-TaskVariable'.
2019-07-19T02:58:22.8219534Z ##[debug]Exporting function 'Get-LocString'.
2019-07-19T02:58:22.8219775Z ##[debug]Exporting function 'Import-LocStrings'.
2019-07-19T02:58:22.8219971Z ##[debug]Exporting function 'Write-AddAttachment'.
2019-07-19T02:58:22.8220186Z ##[debug]Exporting function 'Write-AddBuildTag'.
2019-07-19T02:58:22.8220384Z ##[debug]Exporting function 'Write-AssociateArtifact'.
2019-07-19T02:58:22.8240821Z ##[debug]Adding exceptions types.
2019-07-19T02:58:23.4242116Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\lib.json
2019-07-19T02:58:23.4258236Z 
2019-07-19T02:58:23.4259926Z 
2019-07-19T02:58:23.5622842Z ##[debug]Loaded 15 strings.
2019-07-19T02:58:23.5623707Z 
2019-07-19T02:58:23.5624183Z 
2019-07-19T02:58:23.6790360Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-07-19T02:58:23.6790598Z 
2019-07-19T02:58:23.6790668Z 
2019-07-19T02:58:23.6911976Z ##[debug]Importing the module 'Microsoft.PowerShell.Security'.
2019-07-19T02:58:23.6912832Z 
2019-07-19T02:58:23.6913316Z 
2019-07-19T02:58:23.7350193Z ##[warning]The 'Microsoft.PowerShell.Security' module was not imported because the 'Microsoft.PowerShell.Security' snap-in was already imported.
2019-07-19T02:58:23.7350721Z ##[debug]Processed: ##vso[task.logissue type=warning]The 'Microsoft.PowerShell.Security' module was not imported because the 'Microsoft.PowerShell.Security' snap-in was already imported.
2019-07-19T02:58:23.7351597Z 
2019-07-19T02:58:23.7467957Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\RemoteDeployer.psd1'.
2019-07-19T02:58:23.7524741Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\RemoteDeployer.psm1'.
2019-07-19T02:58:23.8882064Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\module.json
2019-07-19T02:58:23.9162207Z ##[debug]Loaded 10 strings.
2019-07-19T02:58:23.9176743Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-07-19T02:58:23.9182612Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\Strings\resources.resjson\en-US\resources.resjson
2019-07-19T02:58:23.9487322Z ##[debug]Loaded 10 strings.
2019-07-19T02:58:23.9488965Z ##[debug]Exporting function 'Invoke-RemoteScript'.
2019-07-19T02:58:23.9493029Z ##[debug]Importing function 'Invoke-RemoteScript'.
2019-07-19T02:58:23.9494414Z ##[debug]Entering script Utility.ps1
2019-07-19T02:58:23.9722712Z ##[debug]Triming inputs for excess spaces, double quotes
2019-07-19T02:58:24.0255308Z ##[debug]Initiating action 'create or update' website with user specified application pool.
2019-07-19T02:58:24.0261470Z ##[debug]Triming inputs for excess spaces, double quotes
2019-07-19T02:58:24.0282354Z ##[debug]Initiating action 'create or update' website with user specified application pool.
2019-07-19T02:58:24.0873059Z ##[debug]Executing main funnction in AppCmdOnTargetMachines : Invoke-Main -ActionIISWebsite CreateOrUpdateWebsite -WebsiteName "POC" -PhysicalPath "D:\PublishApplication\POC" -PhysicalPathAuth "WebsiteUserPassThrough" -PhysicalPathAuthUsername "" -PhysicalPathAuthUserPassword "****" -AddBinding true -Bindings "{
2019-07-19T02:58:24.0873377Z     `"port`":  `"8086`",
2019-07-19T02:58:24.0873458Z     `"sniFlag`":  `"false`",
2019-07-19T02:58:24.0873504Z     `"ipAddress`":  `"All Unassigned`",
2019-07-19T02:58:24.0873546Z     `"hostname`":  `"`",
2019-07-19T02:58:24.0873599Z     `"sslThumbprint`":  {
2019-07-19T02:58:24.0873626Z 
2019-07-19T02:58:24.0873665Z                       },
2019-07-19T02:58:24.0873704Z     `"protocol`":  `"http`"
2019-07-19T02:58:24.0873767Z }" -ActionIISApplicationPool "CreateOrUpdateAppPool" -AppPoolName "POC-Pool" -DotNetVersion "v4.0" -PipeLineMode "Integrated" -AppPoolIdentity ApplicationPoolIdentity -AppPoolUsername "" -AppPoolPassword "****" -configureAuthentication false -anonymousAuthentication false -basicAuthentication false -windowsAuthentication true -AppCmdCommands ""
2019-07-19T02:58:24.0992859Z ##[debug]Executing Run-RemoteDeployment
2019-07-19T02:58:24.1034386Z ##[debug]Executing Parse-TargetMachineNames
2019-07-19T02:58:24.1207070Z ##[debug]TargetMachineName: 'localhost'
2019-07-19T02:58:24.1254366Z ##[debug]Finished executing Parse-TargetMachineNames
2019-07-19T02:58:24.1353961Z ##[debug]Executing Get-NewPSSessionOption
2019-07-19T02:58:24.1356759Z ##[debug]New-PSSessionOption command: New-PSSessionOption -SkipCACheck
2019-07-19T02:58:24.1516828Z ##[debug]Finished executing Get-NewPSSessionOption
2019-07-19T02:58:24.1541020Z ##[debug]Executing Get-TargetMachineCredential: desktop-0dnhide\hp
2019-07-19T02:58:24.1624955Z ##[debug]Finished executing Get-TargetMachineCredential
2019-07-19T02:58:24.1641826Z Starting remote execution of Invoke-Main script for "IISWebsite" with action "CreateOrUpdateWebsite"
2019-07-19T02:58:24.1642167Z 
2019-07-19T02:58:24.1642368Z 
2019-07-19T02:58:24.2356493Z ##[debug]Entering Invoke-RemoteScript.
2019-07-19T02:58:24.2664601Z ##[debug] targetMachineNames: 'localhost'
2019-07-19T02:58:24.3174718Z ##[debug]Entering Get-TargetMachines.
2019-07-19T02:58:24.3250448Z ##[debug]Target Machines: localhost
2019-07-19T02:58:24.3470370Z ##[debug]ComputerName = localhost
2019-07-19T02:58:24.3502024Z ##[debug]WSManPort = 5986
2019-07-19T02:58:24.3508885Z ##[debug]Authentication = Default
2019-07-19T02:58:24.3509997Z ##[debug]SessionConfigurationName = microsoft.powershell
2019-07-19T02:58:24.3511134Z ##[debug]UseSSL = True
2019-07-19T02:58:24.3511754Z ##[debug]Total target machines are: 1
2019-07-19T02:58:24.3512392Z ##[debug]Leaving Get-TargetMachines.
2019-07-19T02:58:24.3955409Z ##[debug]Entering Get-WinRmConnectionToTargetMachine.
2019-07-19T02:58:24.3956756Z ##[debug] computerName: 'localhost'
2019-07-19T02:58:24.3958325Z ##[debug] port: '5986'
2019-07-19T02:58:24.3988051Z ##[debug] credential: 'System.Management.Automation.PSCredential'
2019-07-19T02:58:24.3989226Z ##[debug] authentication: 'Default'
2019-07-19T02:58:24.3991028Z ##[debug] sessionName: '25e787f9-5c81-4a00-97a0-778e363c1613'
2019-07-19T02:58:24.3992761Z ##[debug] sessionConfigurationName: 'microsoft.powershell'
2019-07-19T02:58:24.3994375Z ##[debug] useSsl: 'True'
2019-07-19T02:58:24.4127334Z ##[debug]Entering Get-NewPSSessionCommand.
2019-07-19T02:58:24.4128264Z ##[debug] computerName: 'localhost'
2019-07-19T02:58:24.4129785Z ##[debug] port: '5986'
2019-07-19T02:58:24.4131184Z ##[debug] authentication: 'Default'
2019-07-19T02:58:24.4132614Z ##[debug] sessionName: '25e787f9-5c81-4a00-97a0-778e363c1613'
2019-07-19T02:58:24.4133968Z ##[debug] useSsl: 'True'
2019-07-19T02:58:24.4135349Z ##[debug] sessionConfigurationName: 'microsoft.powershell'
2019-07-19T02:58:24.4136696Z ##[debug] NoCredential: 'False'
2019-07-19T02:58:24.4156316Z ##[debug]New-PSSessionCommand: New-PSSession -ComputerName 'localhost' -Port 5986 -Authentication Default -Name '25e787f9-5c81-4a00-97a0-778e363c1613' -Credential $credential -UseSSL -ErrorAction 'SilentlyContinue' -ErrorVariable sessionErrors -ConfigurationName 'microsoft.powershell'
2019-07-19T02:58:24.4159939Z ##[debug]Leaving Get-NewPSSessionCommand.
2019-07-19T02:58:24.4184417Z ##[debug]Trying to establish connection: Attempt #1
2019-07-19T02:58:26.5271873Z ##[debug]New-PSSession Error: Connecting to remote server localhost failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
2019-07-19T02:58:56.5343753Z ##[debug]Trying to establish connection: Attempt #2
2019-07-19T02:58:58.5581592Z ##[debug]New-PSSession Error: Connecting to remote server localhost failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
2019-07-19T02:59:28.5595487Z ##[debug]Trying to establish connection: Attempt #3
2019-07-19T02:59:30.5830533Z ##[debug]New-PSSession Error: Connecting to remote server localhost failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
2019-07-19T03:00:00.6006127Z ##[error]Microsoft.PowerShell.Commands.WriteErrorException: Unable to create pssession. Error: 'Connecting to remote server localhost failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.'
2019-07-19T03:00:00.6012917Z ##[debug]Processed: ##vso[task.logissue type=error;]Microsoft.PowerShell.Commands.WriteErrorException: Unable to create pssession. Error: 'Connecting to remote server localhost failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.'
2019-07-19T03:00:00.6095909Z ##[debug]Leaving Get-WinRmConnectionToTargetMachine.
2019-07-19T03:00:00.6517300Z ##[debug]Entering Disconnect-WinRmConnectionToTargetMachines.
2019-07-19T03:00:00.6701326Z ##[debug]Entering Get-RemoteConnection.
2019-07-19T03:00:02.7813624Z ##[error]System.Management.Automation.RuntimeException: The remote session query failed for localhost with the following error message: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".  ---> System.InvalidOperationException: <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150858770" Machine="DESKTOP-0DNHIDE"><f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". </f:Message></f:WSManFault>
2019-07-19T03:00:02.7815139Z ##[debug]Processed: ##vso[task.logissue type=error;]System.Management.Automation.RuntimeException: The remote session query failed for localhost with the following error message: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".  ---> System.InvalidOperationException: <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150858770" Machine="DESKTOP-0DNHIDE"><f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". </f:Message></f:WSManFault>
2019-07-19T03:00:02.7818212Z    at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
2019-07-19T03:00:02.7818379Z    --- End of inner exception stack trace ---
2019-07-19T03:00:02.7952887Z ##[debug]Leaving Get-RemoteConnection.
2019-07-19T03:00:02.7963714Z ##[debug]Leaving Disconnect-WinRmConnectionToTargetMachines.
2019-07-19T03:00:02.7973434Z ##[debug]Leaving Invoke-RemoteScript.
2019-07-19T03:00:02.8081408Z ##[debug]Exception caught from task: System.Management.Automation.RuntimeException: PSSession could not be created for Machine:'localhost:5986'
2019-07-19T03:00:02.8090801Z ##[debug]Finished executing Run-RemoteDeployment
2019-07-19T03:00:02.8174981Z ##[error]Microsoft.PowerShell.Commands.WriteErrorException: Caught exception while executing main function: PSSession could not be created for Machine:'localhost:5986'
2019-07-19T03:00:02.8176209Z ##[debug]Processed: ##vso[task.logissue type=error;]Microsoft.PowerShell.Commands.WriteErrorException: Caught exception while executing main function: PSSession could not be created for Machine:'localhost:5986'
2019-07-19T03:00:02.8812346Z ##[error]PowerShell script completed with 3 errors.
2019-07-19T03:00:02.8825592Z ##[section]Finishing: Manage IISWebsite

person Anand Deshmukh    schedule 17.07.2019    source источник
comment
По умолчанию WinRM использует http / https, то есть порты 5985/5986 соответственно. Вы тоже открывали эти порты?   -  person Merlin Liang - MSFT    schedule 18.07.2019
comment
Да, порт 5985/5986 включен. Я могу увидеть их с помощью команды netstat -a -n   -  person Anand Deshmukh    schedule 18.07.2019
comment
Не могли бы вы запустить Enable-PSRemoting -Force на локальном и удаленном компьютерах и попробовать выполнить задачу еще раз?   -  person Merlin Liang - MSFT    schedule 18.07.2019
comment
@ MerlinLiang-MSFT: да, я уже использую Enable-PSRemoting -force & winrm quickconfig. Целевая машина - это моя локальная машина с Windows 10. Я настроил агент AzureDevops для локального компьютера. Тем не менее я получаю ту же ошибку   -  person Anand Deshmukh    schedule 19.07.2019
comment
Проверяли ли вы это обновление CVE: devblogs.microsoft.com/powershell/   -  person Prasoon Karunan V    schedule 22.07.2019


Ответы (1)


Вам необходимо перестроить WinRM на удаленном компьютере.

Перед восстановлением необходимо сделать резервную копию WinRm.

Поврежденный WMI. Следуйте инструкциям ниже.

Первый шаг к попытке 1. Отключите и остановите службу WMI. а. sc config winmgmt start = отключено b. чистая остановка winmgmt

  1. Выполните следующие команды. а. Winmgmt / salvagerepository% windir% \ System32 \ wbem b. Winmgmt / resetrepository% windir% \ System32 \ wbem

  2. Повторно включите службу WMI, а затем перезагрузите сервер, чтобы посмотреть, как это работает. а. sc config winmgmt start = auto

Если проблема не исчезнет, ​​попробуйте выполнить следующие шаги, чтобы восстановить репозиторий:

  1. Отключите и остановите службу WMI. а. sc config winmgmt start = disabled (обратите внимание, что между '=' и 'disabled' есть пробел) b. чистая остановка winmgmt

  2. Переименуйте папку репозитория (расположенную в% windir% \ System32 \ wbem \ repository) на repository.old.

  3. Повторно включите службу WMI. а. sc config winmgmt start = auto

  4. Перезагрузите сервер, чтобы проверить, сохраняется ли проблема.

Если проблема не исчезнет, ​​попробуйте выполнить следующие действия. Перерегистрируйте все библиотеки DLL и перекомпилируйте файлы .mof в папке wbem, а также повторно зарегистрируйте службу и поставщик WMI. Вы можете использовать следующий сценарий, сохранив его в текстовом файле, затем переименовав его в .bat и запустив из командной строки с правами администратора и переключив фокус на следующий каталог: C: \ Windows \ System32 \ Wbem. @echo off sc config winmgmt start = disabled net stop winmgmt / y% systemdrive% cd% windir% \ system32 \ wbem for / f %% s в ('dir / b * .dll') do regsvr32 / s% wmiprvse / regserver winmgmt / regserver sc config winmgmt start = auto net start winmgmt для / f% s в ('dir / s / b * .mof * .mfl') do mofcomp% s b. Перезагрузите компьютер и протестируйте WMI. Предупреждение. Перестройка репозитория WMI привела к тому, что некоторые сторонние продукты не работают до тех пор, пока их установка не будет повторно запущена и их MOF не будет повторно добавлен обратно в репозиторий.

Если / salvagerepository или / resetrepository не решает проблему, перестройте репозиторий вручную: 1. Измените тип запуска на Службу инструментария управления окнами (WMI) на отключенный 2. Остановите службу WMI; вам может потребоваться сначала остановить службу IP Helper или другие зависимые службы, прежде чем она позволит вам остановить службу WMI 3. Переименуйте папку репозитория: C: \ WINDOWS \ system32 \ wbem \ Repository в Repository.old 4. Откройте подсказку CMD с повышенными правами привилегии 5. CD C: \ windows \ system32 \ wbem 6. для / f% s в ('dir / b / s * .dll') do regsvr32 / s% s 7. Верните тип службы WMI на автоматический и запустите Служба WMI 8. cd / dc: \ ((перейдите в корень диска c, это важно)) 9. для / f% s в ('dir / s / b * .mof * .mfl') выполните mofcomp % s 10. Перезагрузите сервер.

Возможное исправление Win2012. Перейдите в C: \ WINDOWS \ system32 \ wbem \ Rename Repository to Repository.old Найдите папку Repository.xxx с даты до того, как WMI был сломан, и переименуйте в Repository. Перезагрузить сервер

person Veeresh Patil    schedule 24.07.2019