Expose IIS & ASP.Net Core Site/API to the World
Navigate to the router gateway (Ex. http://192.168.0.1). Gateway address can be found by running "ipconfig"
Port forward the public IP to your local IP. https://www.whatismyip.com/ will provide your Public IP & Local IP
Ensure your firewall doesn't block the ports (80 & 443 typically)
Install and/or Configure IIS
Install IIS & IIS Management Service by using "Turn Windows Features on/off" on Windows 10.
For Windows Server, Install Role & Features. Make sure to select the IIS Management Service. This is needed to Web Deploy from Visual Studio.
Install the latest version of the .Net Core Runtime & Hosting Bundle
Update DNS Records
Mine was GoDadday
Add 2 A records: One with @ pointing your public IP AND www also doing the same. TTL can be 600 seconds.
Remove all default records to cleanup except the name servers
Leave the name servers as defaults
Prep IIS for the App - Create a new Website
Add a New Web Siite in IIS
Provie a Sitename (www_example_us)
Create a blank directory & point to it in the Physical Path (c:/<appname>). IIS for weird reason throws exceptions if you set it to c:\<appname>.
Host name should be your domain name
Optionally, Uncheck start the website immediately as this may interfere with update process
Prep IIS for the App - Link the domain with your site
Right click & edit bindings
Add another record with a host name matching the naked domain (i.e. example.us... see www missing)
Optionally, you may also "Edit the bindings" for the "Default Web Site"
Mapping it a to hostname that's having its A address point to the public IP address, disables the access of the website through the IP. In other words, the blank in the host name is necessary for IIS to map the IP to the default web site.
The user can still connect to IIS but will receive a 404, so "hiding" the default web site with a mapping, is not the right way to remove access through the IP address.
Adding another binding with a blank host name restores the use of IP address from the internet
Prep IIS for the App - Configure App Pool
Navigate to the application pools node
Reveal the pool that matches your site name (www_example_us)
Right click to edit the basic settings
Select 'No Managed Code' as Core apps do not use the desktop CLR
Publish app to IIS from Visual Studio
Open Visual Studio
Right click on the ASP.Net Web or Web API project
Click Publish, Select IIS, FTP as the target & Click Publish on the popup
Server should be the computer name you've installed IIS on
Site name is the site name from IIS (Remember we chose "www_example_us")
Leave username, password blank
Destination URL should be the one that we mapped (http://www.example.us)
Clicking validate connection should say OK
You may get a popup for login credentials. Type in the local admin creds of the IIS box
Access the site from your browser
Open your preferred browser
Navigate to http://www.example.us or http://example.us or http://<yourpublicip>>