WinRM cannot connect to remote machines after deploying webapp to IIS

Nguyen Tien 1 Reputation point
2022-11-02T07:58:37.807+00:00

Dear guys,

I'm a .NET developer. And now I am developing a web app (based on Blazor Server App) to monitor some Private/Internet Remote Machines.

I use Visual Studio 2022 Preview latest and develop on .NET 6 (6.0.10).

In order to be able to start implementing, I did the following steps:

  1. Config WinRM
    Config WinRM according to some resources on the Internet was successful.
    The result from the command "winrm quickconfig":

PS C:\WINDOWS\system32> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.

  1. Develop a web app using Visual Studio 2022 Preview latest
    App type: Blazor Server App
    Technical: C#, WinRM, PowerShell
  2. Running Visual Studio (debugging)
    sm1.png
  3. Running from deployed webapp on IIS
    sm2.png
    1. Error detail

WinRM cannot process the request. The following error with errorcode 0x8009030d occurred while using Negotiate authentication: A specified logon session does not exist. It may already have been terminated.
Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains.
After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following command: winrm help config.

Please help me share this error and hope for your help. Thanks in advance.

Best regard,
Tien Nguyen

Internet Information Services
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,591 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,391 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nguyen Tien 1 Reputation point
    2022-11-02T15:24:30.567+00:00

    Dear guys,

    Here is my coding

    (1) Use CIMSession

    sm3.png

    (2) Use PSSession

    sm4.png

    0 comments No comments

  2. Nguyen Tien 1 Reputation point
    2022-11-03T02:02:03.047+00:00

    Sorry, I would like to change the image for 3. Running Visual Studio (debugging) by this

    sm1.png

    Thanks in advance!

    0 comments No comments