Host Web API as Windows Service using OWIN

前端 未结 2 1747
暗喜
暗喜 2021-02-08 03:16

I\'m trying to run a Web API application as a Windows Service using OWIN. However, I get the following message, when trying to start the service:

The [Ser

2条回答
  •  梦如初夏
    2021-02-08 03:53

    When you are getting 'service on Local Computer started and then stopped', generally means there's uncaught exception while starting the service. Take a look at Windows service on Local Computer started and then stopped error, for tips to look for that exception.

    Based on what you described, my guess the issue is caused by the Startup class exists on a different project, have you tried to have the startup class within the window service project?

    Also, the link from HStackOverflow (https://github.com/danesparza/OWIN-WebAPI-Service), shows a work-around approach to load controllers from different project, or dynamically resolve assembly into the current AppDomain. I guess that's also worth trying.

    Hope this helps.

提交回复
热议问题