Hosting WebAPI using OWIN in a windows service

后端 未结 6 918
暖寄归人
暖寄归人 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条回答
  •  孤城傲影
    2020-12-02 09:44

    What worked for me in the end was this value:

    StartOptions options = new StartOptions();
    options.Urls.Add("http://*:9095");
    
    using (WebApp.Start(options))
    {
        ...
    }
    

    Be aware that after adding this, you can only run the application in Visual Studio using Admin mode and the release version of the app needs also to be run in Admin mode.

提交回复
热议问题