Hosting WebAPI using OWIN in a windows service

后端 未结 6 913
暖寄归人
暖寄归人 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:50

    I was facing a similar issue. Below solution worked for me.

    StartOptions options = new StartOptions();
    options.Urls.Add("http://localhost:9095");
    options.Urls.Add("http://127.0.0.1:9095");
    options.Urls.Add(string.Format("http://{0}:9095", Environment.MachineName));
    
    using (WebApp.Start(options))
    {
        ...
    }
    

提交回复
热议问题