103

I've accidentally deleted the default website in IIS; It no longer shows up in the tree of IIS manager and browsing "localhost" returns a 404 error.

I've re-installed IIS, but the default website still doesn't exist... Is it possible to recreate the default website so I can create my folder inside?

1
  • I whacked mine with a wix installer and a empty variable name. Gaaaaaaaaaaaaaaaaaaaaaa. Feb 2, 2017 at 15:40

7 Answers 7

100

Other answers are basically right, thanks to them I was able to restore my default web site, they're just missing some more or less important details.

This was the complete process to restore the Default Web Site in my case (IIS 7 on Windows 7 64bit):

  1. open IIS Manager
  2. right click Sites node under your machine in the Connections tree on the left side and click Add Website
  3. enter "Default Web Site" as a Site name
  4. set Application pool back to DefaultAppPool!
  5. set Physical path to %SystemDrive%\inetpub\wwwroot
  6. leave Binding and everything else as is

Possible issues:

  1. If the newly created web site cannot be started with the following message:

    Internet Information Services (IIS) Manager - The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

    ...it's possible that port 80 is already assigned to another application (Skype in my case :). You can change the binding port to e.g. 8080 by right clicking Default Web Site and selecting Edit Bindings... and Edit.... See Error 0x80070020 when you try to start a Web site in IIS 7.0 for details. Or you can just close the application sitting on the port 80, of course.

  2. Some applications require Default Web Site to have the ID 1. In my case, it got ID 1 after recreation automatically. If it's not your case, see Re-create “default Website” in IIS after accidentally deleting. It's different for IIS 6 and 7.


Note: I had to recreate the Default Web Site, because I wasn't able to even open a project configured to run under IIS in Visual Studio. I had a solution with a couple of projects inside. One of the projects failed to load with the following error message:

The Web Application Project is configured to use IIS. The Web server 'http://localhost:8080/' could not be found.

After I have recreated the Default Web Site in IIS Manager, I was able to reload and open that specific project.

1
  • Yup I had to recreate after blindly deleting it in VM where Im playing around with Active Directory Certificate Services. ADCS will only append the CertEnroll virtual directory for the Certificate Authority to the Default Site.....might just be an ID thing.
    – rism
    Mar 28, 2016 at 7:05
56

Did the same thing. Wasn't able to recreate Default Web Site directly - it kept complaining that the file already existed...

I fixed as follows:

  1. Create a new web site called something else, eg. "Default", pointing to "C:\inetpub\wwwroot"
  2. It should be created with ID 1 (at least mine was)
  3. Rename the web site to "Default Web Site"
4
  • 25
    WARNING: Don't just blindly use 'C:\inetpub\wwwroot' as the physical location for the default website. I just recently had this screw up a piece of software that was reading this value. Check another computer which is CORRECTLY configured and copy that. In the case of Windows 7 x64 at least, the correct value is "%SystemDrive%\Inetpub\wwwroot" -very subtle difference I know, but it can be critical!
    – Adam
    May 16, 2012 at 4:38
  • This helped me as I installed ad fs AFTER I had a couple sites running..but AD FS requires the default site present. On the webs I had to stop them and change the ID's in the advanced settings then start back up.
    – GPGVM
    May 14, 2014 at 14:52
  • In my case, it was important to set also Application pool to "DefaultAppPool", otherwise it was set to the site name. May 6, 2015 at 17:46
  • To delete the website, I had to follow these instructions: forums.iis.net/t/1188768.aspx Jul 29, 2015 at 8:03
10

I suppose you want to publish and access your applications/websites from LAN; probably as virtual directories under the default website.The steps could vary depending on your IIS version, but basically it comes down to these steps:

Restore your "Default Website" Website :

  1. create a new website

  2. set "Default Website" as its name

  3. In the Binding section (bottom panel), enter your local IP address in the "IP Address" edit.

  4. Keep the "Host" edit empty

that's it: now whenever you type your local ip address in your browser, you will get the website you just added. Now if you want to access any of your other webapplications/websites from LAN, just add a virtual application under your default website pointing to the directory containing your published application/website. Now you can type : http://yourLocalIPAddress/theNameOfYourApplication to access it from your LAN.

2
  • 1
    Original Default Web Site (which is what OP asks) doesn't have binding set to a specific address. Instead it uses "All Unassigned", which is then presented as asterisk (). Also you're missing *Physical path and Application pool, which have to be set properly. May 6, 2015 at 17:42
  • The 4th step is very important. This should be the accepted answer. Apr 9, 2020 at 17:03
4

You can try to restore your previous state by doing the following:

  1. Go to IIS Manager
  2. Right-click on your Local Computer.
  3. Point to All Tasks
  4. Point to Backup/Restore Configuration
  5. Select the configuration you want to restore
  6. Wait untill configuration applies
1
  • I can't see this option. I'm on IIS v10 on Windows Server 2019.
    – RBT
    Oct 28, 2021 at 9:42
3

Check out this answer on SuperUser:

In short: Reinstall both IIS and WAS.

In details -

Step 1

Go to "Add remove programs" "Turn windows features on or off" Remove both IIS and WAS (Windows Process Activation Service) Restart the PC Step 2

Go to "Add remove programs" "Turn windows features on or off" Turn on both IIS and WAS (Windows Process Activation Service) Note: Reinstalling IIS alone won't help. You have to reinstall both IIS and WAS

This approach fixed the problem for me.

0
0

Follow these Steps Restore your "Default Website" Website :

  1. create a new website
  2. set "Default Website" as its name
  3. In the Binding section (bottom panel), enter your local IP address in the "IP Address" edit.
  4. Keep the "Host" edit empty
-1

I deleted the C:\inetpub folder and reinstalled IIS which recreated the default website and settings.

0