Hosting/Deploying your website in local IIS

Hosting/Deploying your website in local IIS 

NOTE: Assuming readers are already aware of  Visual Studio Environment.

Objective: Most likely, you don't want to keep your project constantly running in Visual Studio, so it'd be better to keep it as service. In this case, we are deploying it to a local dedicated server using IIS (Internet Information Services).


  • We can deploy a website/web API. in my case it is a WebAPI.
  • After the project completion build your solution (Ctrl+Shift+B in Visual Studio).
Build your solution

  • First, open the IIS (using command prompt, open inetmgr).

  • On the left side under Sites - add a New Website (from the right panel or right-click on the Sites).
  • Put in the following details: Site name, "webapi.kamal.net"; Physical path, "C:\projects\webapi" (where your solution is located); Binding - Http or Https; the hostname will be the same, i.e. "webapi.kamal.net."

  • Click OK.
  • Now open - C:\Windows\system32\drivers\etc 
  • Copy hosts file to another location and open it in the editor [notepad etc,.]
  • You need to add the following to the end of this file:
  • # Web API host
  •  127.0.0.1       webapi.kamal.net

  • Now you need to put the modified file back in the C:\Windows\system32\drivers\etc folder. As this folder is protected by Windows by default, you will get an access denied warning message, so you need to copy the file "As Administrator."
  • Right click on web site in ISS - manage  website - browse. Or open your browser - go to -  http://webapi.kamal.net/ 
  • You will get your site up and running :)



  • Thank you. :)

Comments

Popular posts from this blog