Is it safe to delete the "InetPub" folder? - iis-7

Does anyone know if deleting the InetPub folder will hurt IIS or anything related?
I am using IIS 7.

IIS will create it again AFAIK.

As long as you go into the IIS configuration and change the default location from %SystemDrive%\InetPub to %SystemDrive%\www for each of the services (web, ftp) there shouldn't be any problems. Of course, you can't protect against other applications that might install stuff into that directory by default, instead of checking the configuration.
My recommendation? Don't change it -- it's not that hard to live with, and it reduces the confusion level for the next person who has to administrate the machine.

If you reconfigure IIS7 to use your new location, then there's no problem. Just test that the new location is working, before deleting the old location.
Change IIS7 Inetpub path
Open %windir%\system32\inetsrv\config\applicationhost.config and search for
%SystemDrive%\inetpub\wwwroot
Change the path.

Don't delete the folder or you will create a registry problem. However, if you do not want to use IIS, search the web for turning it off. You might want to check out "www.blackviper.com" because he lists all Operating System "services" (Not "Computer Services" - both are in Administrator Tools) with extra information for what you can and cannot disable to change to manual. If I recall correctly, he had some IIS info and how to turn it off.

it is safe to delete the inetpub it is only a cache.

Related

How to check the history of advanced settings for web sites in IIS

I have configured the physical path (SAN Storage) in advanced settings in the IIS
Looks like the path has been changed recently and the files are not getting saved
Is there a way where I can check what the previous value was for the particular field??
I need to know what was the previous value for Physical Path
PFB the image
I don't think there's a history for that in IIS.
If you don't have much directory in wwwroot and you know how the website looks, you can try setting the physical path to the directory within inetpub > wwwroot starting with the root.
If you are lucky, someone might have enabled the logging for IIS configuration. Check if thats the case and you can see the changes.
check following article for reference
IIS config auditing

ASP.NET - Publishing a web site to IIS

What is the difference between publishing a website to {localdrive}\inetpub\wwwroot and anywhere else on the web server e.g. C:\Website.
I have noticed that I am always left with a directory and a website in the IIS console if I publish to {localdrive}\inetpub\wwwroot.
After reading articles on MSDN, I am still unclear of the difference. I realise that there is probably a simpe answer to this, but I cannot find it.
The web path / is already mapped to c:\inetpub\wwwroot, so /abc is mapped to c:\inetpub\wwwroot\abc automatically.
When you publish to c:\website, you need to set up a virtual path manually.
Nothing too much as your website path in IIS can point to any directory. However, that being said always double check your directory permissions and security settings. In addition, I guess if a hacker did compromised your webserver... the default c:\inetpub\wwwroot is well known.
And just for good measure in case you are having issues - check out the Aspnet_regiis.exe tool on MSDN as it usually solves a lot of issues for folks.
{localdrive}\inetpub\wwwroot is usually used for the default web site that comes with IIS.
Additional Microsoft products use the same directory and take advantage of the virtual directories that exist in the default site.
If this is your personal web site, or a web site you created from scratch, you can publish anywhere you want.
Before you publish, you need to make sure IIS knows where the directory will be, and you need to assign the correct permissions for that folder.
The default website in IIS is mapped to C:\inetpub\wwwroot by default, so publishing to wwwroot makes it easy to add applications as virtual directories.
However, you can publish wherever you like, and either point a virtual directory or new website at your publication location. You simply need to make sure user the App Pool is running as (usually IUSR under IIS7, IUSR_MachineName under previous versions) has read/execute permissions on the folder you are publishing to.
Although they say Virtual Directory created by default for your website in wwwroot and you don't have to configure it again. Many times I found we still have to go there and click on Remove and then click on Create button again :)
Thus it is almost no problem if you create your website outside wwwroot, only difference outside you have to give full path of VD and inside you have to click Remove and then Create button
The problem I had was different from all of the above. I was trying to publish in "C:\inetpub\wwwroot" and the publish failed every time. Than i changed the publish folder to another and it worked. When I launched visual studio as administrator I could copy to C:\inetpub\wwwroot also without problems

asp.net log files permissions

Our asp.net app writes errors to a text log file in the web sites root folder. This has lead to all sorts of permission problems, different flavors of IIS and windows allow different things by default.
So what I am wondering is there a location somewhere in Windows where all types of users can write a file without any extra permissions that will also work for all IIS and flavors of windows?
I am thinking of the ApplicationData folder, but did this exist in Server 2003 ?
Thanks,
AJ
The easiest solution would be to use the App_Data subfolder of your web application for this. By default it's not viewable from the web, so Internet clients won't be able to read the logs.
Depending on your deployment method, you might have to change the permission to allow write access to this folder (to the user under which your web application is running).
Alternatively, there is a place where every user can write to: It's that user's temporary folder, which you can access through Path.GetTempPath. This, however, does not sound like a suitable location for log files.
You should always first think about wwwroot folder (%systemdrive%\inetpub\wwwroot) because it has the required permission.
The permission you need is to set a full control for IIS_IUSRS
Edit: you can simply give Everyone Full Control (not recommended at all) but this solves most of ntfs permissions issues with IIS

How to take backup in IIS

How do I take a backup of a site (and its settings) in IIS7 so that later if something goes wrong I can go back to my previous settings?
Updated:
I just want the settings, main website/sub- application, application pool etc. I can restore code from svn.
You can do the following:
%windir%\system32\inetsrv\appcmd.exe add backup "backup_name"
The above basically backs up %windir%\system32\inetsrv\config
You can also look into application config history: http://learn.iis.net/page.aspx/129/using-iis-70-configuration-history/
You probably want to start with (assuming a normal installation)
c:\windows\system32\inetsrv\config\applicationHost.config
as that's where the IIS config file is for websites.
There's not really the same "backup this site" like there was in IIS6, since they redid the underlying model.

How can I duplicate a website's settings in IIS7?

I'm going mad trying to get an ASP.NET application running on IIS7 (Server2008).
I have one web site set up in IIS7 which works fine. I'm trying to create another one now but I only get 404s for all .aspx files. The Handling Mappers are all different from the working site's.
Is there any way I can duplicate the working site's settings so I don't have to go through 50 mappings manually.
Or is there a better way to get the correct settings?
removed dead ImageShack links
IIS7's default configurations are held in c:\windows\system32\inetsrv\config\applicationHost.config
Any changes you make on a per site/application basis are stored in the web.config for that site/application.
You should be able to simply copy the files onto the second server.
If you are merely trying to re-install the default ASP.NET mappings, the best way to do that is use
aspnet_regiis.exe
which is in the %windir%\Microsoft.NET\Framework\v___ folders (depends on which version you're trying to set -- looks like 3.5?)
Use the documentation at http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx to see whether you want to use the -i, -r, or -s option.
For IIS 5 (and 6?), Microsoft had a free download called MetaEdit. It was used for just this - backing up and restoring an IIS configuration from machine to machine. Check MS's web site to see if there is an updated version for IIS 7.

Resources