How to Deploy Owin Self Hosted Application In Production?
Asked Answered
O

1

5

I have an Asp.Net Owin Self Hosted WebApi application. The application can be installed as a windows service in production environment.

Currently I'm running and accessing the service via url http://localhost:8000 successfully.

Now I want to map the service to a domain to access it from public network. I have a registered domain and have control over it. Ex: www.myservice.com

How can I point the domain to WebApi service for a Self Hosted Application?

Operation answered 7/4, 2017 at 7:2 Comment(5)
Do you want to host your application on-premises?Lauretta
Or you are going to host that inside a VM somewhere on Cloud?Lauretta
@AdnanUmer I need to host it in a Windows VM. (In the same VM i'm hosting some other web application through IIS)Operation
IIS will be already using 80 port. Do you want to host that on the different port? may be on 8000?Lauretta
I have no restrictions on port number. I can use ports such as 8000.Operation
L
8

In order to allow public access to your Self-hosted OWIN Web API app. Follow following Steps:

  1. Allow Inbound Connections from Firewall

    Run wf.msc command to open up Windows Firewall with Advanced Security and add a new Inbound Rule for TCP port 8000 or the port you want to use.

    You can make sure your service is getting request by opening <machine public ip>:8000 from other machines.

  2. Get Static IP from ISP

    Request your ISP for static IP. Most of the times ISP charges extra for that. If you already have static IP, skip this step and move to next step.

  3. Point your domain to static IP

    Lastly, go to your domain DNS Manager and add an A Record with Host Name = www and IP Adress = <your machine static IP>.

    You might also need to add another A Record with Host Name = @ and IP Adress = <your machine static IP> if you want also want to access your service without www.

    The procedure of adding A Record varies. You can simply read knowledge base documents provided by your registered on how to add A Record.

Lauretta answered 7/4, 2017 at 12:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.