How to access Web API published externally in IIS [closed]

1

I developed an ASP.NET Web Application (API) in Visual Studio 2015 and published it in IIS 6.1 to access locally. Now I need to make my machine available as a server for external access. How to do this?

    
asked by anonymous 15.04.2016 / 13:48

2 answers

3

A complete answer depends on how structured your environment is, and is not trivial. I will list the requirements superficially; you need to work out the details.

I'm assuming:

  • A typical home connection (non-permanent IP address);
  • A non-commercial router like this ;
  • An IIS computer serving your WebAPI.

The necessary steps would be:

  • Configure your router to allow external connections to be routed to the IIS computer;
    • Determine the local IP of your machine, or your MAC Address ;
    • Set up the port forwarding function, indicating that all external source connections to ports 80 (HTTP) and 443 (HTTPS) are routed to your server (via IP or MAC Address );
  • Set up a dynamic DNS service so your machine has a 'name' on the internet - otherwise users will only be able to access your service if they know your IP (which, if dynamic, will be periodically changed). Some options:

This will allow you to offer your WebAPI to the internet in general. However several other points should be considered:

  • You are opening your machine to the internet, and it is a potential target for malicious users;
  • The number of users you can serve is limited by your upload speed / quota - which is generally quite low on non-commercial contracts;
  • Access providers in Brazil generally do not like users offering services directly, so make sure your contract with your access provider allows this type of setup .
15.04.2016 / 15:20
1
So I ended up finding a post on the dotnetmentors.com site, where the author ends up giving several hints on how to host ASP.NET Web API in IIS using Visual Studio being one of the methods present in own program.

The author cites two types of hosting: Auto Hosted, IIS hosting

IIS hosting (which is the method you want), this is well detailed as shown below:

  

Host CustomerApp in IIS
  Open IIS Manager by clicking Windows Start -> Run - > type inetmgr - > click OK

   If IIS is not installed on your computer, click here to install.    Go to the IIS manager and right click on places and select - > - > Add site.

   Add a new web site to IIS

   Enter the details, as shown in the image below

   Enter site name as CustomerApp
   Changing the Application Pool for ASP.net V4.0
   Choose the physical path of the folder that contains the ASP.NET Web published API. - > I entered as C: \ CustomerApp
   Enter the port number on which you want to host the API. I use the port - > such as 9810.

Links:
dotnetmentors.com
#

    

15.04.2016 / 14:25