Can't start Windows Service with HTTPS Certificate

Hello!
I want to run our Windows Service using HTTPS. I edited the appsettings.json file located in ProgramData.
After making the changes, the Windows Service starts but crashes immediately.

Here’s what my JSON looks like:

{
    "Kestrel": {
        "Endpoints": {
            "HTTPS": {
                "Url": "https://*:443",
                "Certificate": {
                    "Subject": "servername.censored",
                    "Store": "My",
                    "Location": "LocalMachine",
                    "AllowInvalid": "true"
                }
            }
        }
    },
    "Plugins": [
        "SQLite"
    ],
    "Data": {
        "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
        "ConnectionString": "Data Source=%ProgramData%\\UniversalAutomation\\database.db"
    },
    "Mode": "Server",
    "PSUTelemetry": false
}

https://jsonlint.com/ tells me hat the JSON is valid.

systemLog:

2025-07-07 09:14:26.247 +02:00 [ERR] Error configuring web server.
System.IO.InvalidDataException: Failed to load configuration from file 'C:\ProgramData\PowerShellUniversal\appsettings.json'.
 ---> System.FormatException: Could not parse the JSON file.
 ---> System.Text.Json.JsonReaderException: Expected depth to be zero at the end of the JSON payload. There is an open JSON object or array that should be closed. LineNumber: 22 | BytePositionInLine: 1.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()

Thanks in Advance!

Product: PowerShell Universal
Version: 5.5.4 (15428518832)

Hey, I cant see anything wrong with the JSON Syntax itself, and use all but one of the same config options in my appsettings file…

I’m not really familiar with ‘Mode’ (I dont have that defined in mine at all) so I looked that up in the docs: App Settings | PowerShell Universal

It says it’s for git and should be set to either ‘manual’ or ‘automatic’, also the error points to line 22, and that’s line 22. Where did you get the “Server” value from?

Thanks for your reply!
That’s just what my appsettings.json looked like after installation.

{
  "Kestrel": {
    "Endpoints": {
      "HTTP": {
        "Url": "http://*:5000"
      }
    }
  },
  "Plugins": [
    "SQLite"
  ],
  "Data": {
    "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
    "ConnectionString": "Data Source=%ProgramData%\\UniversalAutomation\\database.db"
  },
  "Mode": "Server",
  "PSUTelemetry": false
}

Hi,

we are using PSU 5.5.1 and this is our appsettings.json

{
  "Kestrel": {
    "Endpoints": {
      "HTTPS": {
        "Url": "https://*:443",
        "Certificate": {
          "Subject": "censored",
          "Store": "My",
          "Location": "LocalMachine",
          "AllowInvalid": true
        }									
      }
    }
  },			
  "Plugins": [
    "SQL"
  ],
  "Data": {
    "RepositoryPath": "censored",
    "ConnectionString": "censored"
  },
  "Mode": "Server",
  "PSUTelemetry": true,
  "SystemLogLevel": "Error"
}

maybe there is a problem if the json file ends with a boolean while using https, try to add the “SystemLogLevel” part just to try. Otherwise this could be a bug in the version 5.5.4.

Thanks for the help.
I could solve my problem.
I’ve created another cert which worked. Couldn’t really figure out why..

I really appreciate your fast help!