简体   繁体   中英

How to launch self-hosted OWIN-based web api on my domain?

I would like to deploy my ASP.NET Web Api on my domain that I recently bought. I want to also self-host it, so that I don't need IIS. As I read from tutorials, I would need to launch this console application on my server so that I can self-host my web api:

public class Program
{
    static void Main(string[] args)
    {
        // Specify the URI to use for the local host:
        string baseUri = "http://localhost:8080";

        Console.WriteLine("Starting web Server...");
        WebApp.Start<Startup>(baseUri);  // Startup is my class that has configurations for my web api
        Console.WriteLine("Server running at {0} - press Enter to quit. ", baseUri);
        Console.ReadLine();
    }
}

The problem is, I am only able to drop files on my domain with an FTP client (such as WinSCP). What do I need to do to actually run this application on my domain so that it can actually route the HTTP requests to my web api?

You can run this console application on a machine at home (although, you would need to forward requests to the public ip of your router, and allow for port-forwarding on the router to the appropriate private IP address that is hosting the application) or you could run this console application on an EC2 instance in Amazon Web Services (AWS... as well as several other cloud-based service providers, and do similar forwarding of requests and what not with the AWS setup). I would suggest reading up about domains, hosting, request forwarding, and port-forwarding prior to moving forward. It is unlikely that your current setup will allow you to run this application (in that they are likely providing the service of hosting static content... although some hosting providers may allow for the execution of custom applications and scripts).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM