Description
Due to issues trying to get WebListener to run under IIS (see #1306), I am trying to implement a workaround and self-host via WebListener. We are attempting to do this via a service using sc.exe to create a service from the web.cmd file that is produced by publishing our app.
I am able to successfully run web.cmd manually from the command line with no problems. And I was able to successfully create a service using sc.exe using the path to web.cmd as the bin path. However, the service never starts, and after I attempt to start the service just one time I am now no longer able to run web.cmd manually from the command line. Doing so results in the exception "Microsoft.Net.Http.Server.WebListenerException (0x80004005): The prefix 'http://*:5004/' is already registered.". I've tried using different URLs and port numbers, and the result is always the same: manually calling web.cmd from the command line works until I try to run it as a service.
(And yes, i realize that this is a strange way of doing it. We're attempting to implement a workaround to the issue referenced in the link above.)