Yesterday i had to host an ASP.NET website on my computer. What i did to host an ASP.NET website from my computer is written below in detail.
Things you need to host an ASP.NET website from your computer:
- Web-server installed on your machine. Running on some valid port (80 is recommended).
- Firewall Exception to allow HTTP connections.
- A URL pointing to your system.
- A DNS service to point a URL to your system. A dynamic IP is not a problem 🙂
ProcedureÂ to host an ASP.NET website from your computer:
1. Install Internet Information System (IIS 7.5) on Your computer to host an ASP.NET website. You can follow the tutorialÂ to install Internet Information system on your computer. What i did is, i checked all the featuresÂ relevantÂ to IIS to install them.
2. Add Firewall Exception to allow HTTP requests. Make sure both World Wide Web Services (HTTP) and Web Management Service (HTTP) are added in exception list. See the following Image:
3. Get a URL pointing to your computer. To do this you need a DNS service. I used a free DNS service freedns.
- Make an account.
- If you have a dynamic IP, then click on Dynamic DNSÂ from main menu.
- Click Dynamic DNS Clients to downloadÂ FreeDNS update Windows client,Â here is the direct link,Â and install it.
- Register a domain orÂ sub-domain. I had to test my application so i justÂ registeredÂ a sub-domain.
- Click onÂ SubdomainsÂ and add a sub-domain. I registeredÂ haristest.mooo.com. Where mooo.com is a public domain and this public domain allows any user to register a sub-domain. Destination shows your computer public IP where the sub-domainÂ will be pointing. See following image for details:Â
- Note: Adding domain or sub-domain takes time so it may happen that sub-domain may not work initially. Wait for some time (around 1 hour) and it would be working.
- Tip: some times even after waiting your sub-domain may not work. In that case shutdown FreeDNS update application, delete sub-domain and register the sub-domain again.
- Run FreeDNS update application and in settings tab provide your credentials and get domain list. This application will update your domain or sub-domain settings whenever your IP address is changed.
- Test your hosted domain. GotoÂ http://localhost:80/,Â GotoÂ http://22.214.171.124:80/Â and GotoÂ http://haristest.mooo.com:80/Â all will show same screen.
- Note: IfÂ http://localhost:80/Â doesn’t show page written “IIS7” like in above image, then your IIS server is not working properly you may need a restart to make it functional.
Note: Hosting a website on your system is not secure by default.
You can ask questions and write suggestions to improve this post in your comments.