Hosting WebAPI using OWIN in a windows service

后端 未结 6 903
暖寄归人
暖寄归人 2020-12-02 09:23

I\'ve self-hosted Web API using OWIN (inside a windows service). From what I understand, this is enough to make HTTP requests come to the windows service. I\'m able to hit t

6条回答
  •  萌比男神i
    2020-12-02 09:55

    Similar issue. I had written a ServiceStack Service and hosted it inside a Windows service using an AppSelfHostBase implementation. Note: This was written as a Net Core application that compiles as a console application but, through the magic of PeterKottas.DotNetCore.WindowsService (available through NuGet) can be installed as a Windows Service.

    I set the baseAddress to http://*.8088/ and passed it to my AppSelfHostBase implementation, but I could only reach the service from the same machine it was installed on and no other, as ascertained by trying to open the metadata page (http://[machine]:8088/api/metadata) in a browser. The solution was to add my console application .exe file to the list of allowed apps in Windows Firewall on the server where it was installed. Just go to the Firewall "allowed app" dialog in control panel on the server, click the "Allow another app..." button, and navigate to the Windows Service executable:

提交回复
热议问题