Powershell Universal extension for VSCode unable to connect when HTTPS is configured

Hello,

The extension cannot connect to powershell universal when using https.
When I click the extension, Powershell universal starts and I can open the webpage and everything is working fine.

However inside VS code, I get this error:

Failed to connect to PowerShell Universal. You can configure the connection information in settings.

I’m using the dotnet dev-certs command to generate and trust the certificate for localhost.

In the extension settings, the correct App Token is present, and the https port is configured, matching the kerstel port from appsettings.json.

So I can perfectly reach everything in my browser, but the extension cannot connect.

Are you putting HTTPS://localhost:443 (or whatever port) in the computer name in the settings? It might be trying to use HTTP if the HTTPS isn’t specified.

In the computername was just ‘localhost’ (so without protocol or port) but you are right that it tries to connect over http, not https.

If I put ‘https://localhost:443’ in the computer name setting, it tries to connect to ‘http://https://localhost:443:443’

It’s weird that it’s prepending the http.

I would think that if you remove the port from the computer name setting it won’t double that up but there is something wrong with the logic http logic.

I’ll see if I can fix it.

1 Like

I’m not familiar with typescript but would you need something like this?

and the same for https?
Maybe add a setting with a checkbox for https?

The exclamation point before address asserts if it’s not Null instead of ‘not startswith’?

Anyway thanks for the quick reply, I can continue building without https but I need https to set up ADFS SSO

I had this too and I had to use the FQDN rather than ‘localhost’ so https://myserver01.domain.local:443

Try that as a quick workaround.

Useful for me when I’m connecting to VSC from a remote machine.

I have this in my appsettings.json

“Endpoints”: {

  "HTTP": {

    "Url": "http://localhost:5000"

  },

  "HttpsDefaultCert": {

    "Url": "https://localhost:5001"

  }

}

I’m connecting to powershell universal, running inside VS Code

Maybe try setting the listening address to the fully qualified domain name rather than localhost and then try the same fqdn in powershell universal extension?

my certificate is issued to localhost… I guess you are working with a computer certificate in a certificate store?

Ah yes sorry, missed that.

Yeah I’m hosting in IIS with a a cert installed into local machine store.

It’s a wildcard cert that covers my root domain.