UseWindowsService problem RRS feed

  • Question

  • User-1792241726 posted


    to transform my asp.net core in a Windows service I use function UseWindowsService() included in Microsoft.Extensions.Hosting.WindowsServices.

    All seem to works well when I install it as a service but I noticed a strange problem:  if in the appsettings.json there is a single '\' in any point of file, the service not start and return error 1053.

    I tried to update to last version of the Microsoft.Extensions.Hosting.WindowsServices (5.0.1) but the problem persists.

    Have you ever encountered this type of problem?

    The things is that if my service doesn't start due to this problem on the configuration file I can't even log on file.

    How can I solve?

    Thank you in advance!

    Wednesday, April 7, 2021 3:54 PM

All replies

  • User-474980206 posted

    if the app gets a parsing error with appsettings.json it may fail to start or at the return parameter is invalid. as \ is a quote character in json, a single \ is probably an error. you probably want \\

        "filename": "c:\\temp"

    Wednesday, April 7, 2021 9:40 PM
  • User1686398519 posted

    Hi LArmstrong1985, 

    If you have to use special character in your json string, you can escape it using \ character.

    In the rules of json, you must use \\ to escape the backslash every time.

    Best Regards,


    Monday, April 12, 2021 6:53 AM