How to setup an asp.net website on localhost

First lets start by setting up the site in IIS…

1.Open IIS by double-clicking on Control Panel->Administrative Tools->Internet Information Services

2.Right Click on Web Sites->Default Web Site

3.Click on Properties->Home Directory and choose the location of your website

Now lets give the ASPNET account the appropriate permissions to access that directory…

  1. Using My Computer or the Windows Explorer, navigate to the folder containing the website you choose in the previous step

  2. Right click on the folder and and go to Properties->Security

  3. On the Security tab, click on Add to locate the ASPNET account

  4. Click on Locations and select the local machine

  5. Click on Advanced->Find Now to list all the user accounts on your local machine

  6. Choose ASPNET and click on OK. (If you don’t see ASPNET account in there, go to step 11)

  7. Return to the security tab. Select the ASPNET user account and check the Full Control checkbox under the allow column. Click OK.

  8. Thats it! You should now be able to go to http://localhost/ in your browser window and see your website.

If you don’t see an ASP.NET account in Step 8 then…

  1. Run “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ aspnet_regiis.exe -i -enable” in the command line window and then repeat steps 1 through 10.

Following steps are optional. They help you configure your web project to automatically reference the local web-server when you run or debug a site instead of launching the built-in web-server itself…

  1. Open Visual Studio and select your web-project in the solution explorer, right click and select Property pages.

  2. Select the Start Options from the left navigation, and under Server change the radio button value from ‘Use default Web server’ to ‘Use custom server’. Then set the Base URL value to be: http://localhost/

Now, when you click on any page in the app and then hit F5 or Ctrl-F5, the IDE will use the local web-server instead of popping up its own.

If you liked this post, 🗞 subscribe to my newsletter and follow me on 𝕏!