Is there a way to reset IIS 7.5 to factory settings? - iis

I modified a lot of options in IIS, and would like to reset its settings to default.
I already tried installing/reinstalling it. After the reinstall, it still had the site I created. It was still breaking on the setting I made to the DefaultWebSite.
People suggested uninstalling Windows Process Activation Service first, but it seems like it wasn't installed anyway, so I can't really uninstall it.
How can I reset this installation of IIS back to an out-of-the-box state?

You need to uninstall IIS (Internet Information Services) but the key thing here is to make sure you uninstall the Windows Process Activation Service or otherwise your ApplicationHost.config will be still around. When you uninstall WAS then your configuration will be cleaned up and you will truly start with a fresh new IIS (and all data/configuration will be lost).

There are automatic backup under %systemdrive%\inetpub\history but it may not help much if you already made lots of changes.
http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
You will have to regularly back up manually using appcmd.
If you try to reinstall IIS, please first uninstall IIS and WAS via Add/Remove Programs, and then delete all existing files under C:\inetpub and C:\Windows\system32\inetsrv directories. Then you can install again cleanly.
WARN: beginners on IIS are not recommended to execute the steps above without a full backup of the system. The steps should be executed with caution and good understanding of IIS. If you are not capable of or you have doubt, make sure you open a support case with Microsoft via http://support.microsoft.com and consult.

What worked for me was going to the article someone else had already mentioned, but keying on this piece:
application.config.backup is not created by automatic backup. The backup files are in %systemdrive%\inetpub\history directory. Automatic backup is also a Vista SP1 and above feature. More information can be found in this blog post, http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
I was able to find backups of my settings from when I had first installed IIS, and just copy and replace the files in the inetsrv\config directory.
Source: http://forums.iis.net/t/1085990.aspx

There is one way that I have used my self. Go to Control Panel\Programs\Turn Windows features on or off then uninstall IIS and all of its components completely. I restart windows but I'm not sure if it's required or not. Then install it again from the same path.

This link has some useful suggestions:
http://forums.iis.net/t/1085990.aspx
It depends on where you have the config settings stored. By default
IIS7 will have all of it's configuration settings stored in a file
called "ApplicationHost.Config". If you have delegation configured
then you will see site/app related config settings getting written to
web.config file for the site/app. With IIS7 on vista there is an
automatica backup file for master configuration is created. This file
is called "application.config.backup" and it resides inside
"C:\Windows\System32\inetsrv\config" You could rename this file to
applicationHost.config and replace it with the applicationHost.config
inside the config folder. IIS7 on server release will have better
configuration back up story, but for now I recommend using APPCMD to
backup/restore your configuration on regualr basis. Example: APPCMD
ADD BACK "MYBACKUP" Another option (really the last option) is to
uninstall/reinstall IIS along with WPAS (Windows Process activation
service).

Resetting IIS
On the computer that is running Microsoft Dynamics NAV Web Server components, open a command prompt as an administrator as follows:
a. From the Start menu, choose All Programs, and then choose Accessories.
b. Right-click Command Prompt, and then choose Run as administrator.
At the command prompt, type the following command to change to the Microsoft.NET\Framework64\v4.0.30319 folder, and then press Enter.
cd\Windows\Microsoft.NET\Framework64\v4.0.30319
At the command prompt, type the following command, and then press Enter.
aspnet_regiis.exe -iru
At the command prompt, type the following command, and then press Enter.
iisreset

Related

Set mailroot directories for IIS SMTP

Using IIS 7.5 on Windows Server 2008 R2
I need to change the default location for ALL SMTP directories (default locations shown below):
C:\inetpub\mailroot\Badmail
C:\inetpub\mailroot\Drop
C:\inetpub\mailroot\Pickup
C:\inetpub\mailroot\Queue
to the following:
D:\smtp\badmail
D:\smtp\drop
D:\smtp\pickup
D:\smtp\queue
The ONLY directory which is configurable via Start -> Administrative Tools -> Internet Information Services IIS (6.0) Manager is the "Badmail" directory -- a new directory can be entered directly using the IIS (6.0) Manager.
No other option is available for the other 3 directories.
Is there any way to change these directories WITHOUT:
a) Having to install adsutil.vbs?
Is it possible to change these via Powershell?
Did I miss something or some other utility that can do this?
Any help/advice would be appreciated.
Thanks in advance
I going to try to answer my own question... Can anyone (Microsoft) verify if this is correct before I try this little plan?
Start -> Administrative Tools -> Internet Information Services IIS (6.0) Manager
Right-click on sever name and select "Properties"
Check box labeled "Enable Direct Metabase Edit" -> Click OK
Stop the SMTP site.
Using NotePad, open the MetBase file located at C:\Windows\System32\inetsrv\MetaBase.xml
Update the locations for the "Badmail", "Drop", "Pickup" and "Queue" directories. Save file.
Start the SMTP site.
From this point forward, the new directories should be used -- correct?
I didn't find that the accepted answer worked for me in IIS 8.5 Windows Server 2012 R2, but I did find a solution that worked. It requires using the adsutil.vbs that gets installed if you add the feature under the add roles or features wizard - features - management tools - iis6 management compatibility - iis6 scripting tools:
ref. https://www.itnota.com/moving-default-smtp-folders-to-different-drive-windows-server/
Launch Command Prompt (Admin) and run these commands:
net stop smtpsvc
set util=C:\inetpub\AdminScripts\adsutil.vbs
set dst=D:\smtp\
robocopy c:\inetpub\mailroot %dst% /e /copyall /dcopy:T /move
cscript.exe %util% set smtpsvc/1/badmaildirectory %dst%Badmail
cscript.exe %util% set smtpsvc/1/dropdirectory %dst%Drop
cscript.exe %util% set smtpsvc/1/pickupdirectory %dst%Pickup
cscript.exe %util% set smtpsvc/1/queuedirectory %dst%Queue
net start smtpsvc
This only moves folders and sets paths for the first SMTP virtual server. For others, change "smtpsvc/1/" to "smtpsvc/2/", and possibly comment out the robocopy depending on how your paths were configured for the other smtp virtual servers.

msdeploy: allowuntrusted is being ignored

I have a machine [A] running fresh installation of Win2008 R2 which holds a webapp on IIS. I try to use msdeploy command line tool on machine [B] to publish a deployment package to this machine, but i keep on getting error regarding certificate.
I am using -allowuntrusted, but it still keeps on giving the same error.
I've been trying different things (like changing msdeploy port on IIS, installing certificate on the other machine, reinstall iis roles, tons of other) for 2 days now with absolutely no luck.
This is what I run:
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName="https://machineA:8173/msdeploy.axd?site=app.com",UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted
To make things more interesting, this is what I get when I run the same command on the IIS-containing machine (even after changing dest to sync):
Error: A '-dest' argument must be specified with the 'sync' verb.
Error count: 1.
Any ideas?
EDIT:
I tried using the same settings (ip, package, authentication) in Visual Studio 2012 to create a publishing profile which deploys. After hitting "Verify connection", I got a popup asking if I want to accept this untrusted certificate. I clicked yes and went on to publish - that went through just fine.
Is there a way to get this behaviour with msdeploy command line? Using VS2012 is not an option for me, since publishing must be done automatically.
EDIT 2:
The fun continues: it works on another Windows Server 2008 R2 target machine (not a clean install though). So, where's the magic checkbox? :)
So, I managed to figure out 2 solutions:
Get a valid certificate (we had one in company, so playing around with hosts on machine [B] to match IP with company's domain, helped).
Place "-allowUntrusted:true" BEFORE "-dest" instead of at the end. No clue why does it work on one but not another machine.
Hope this helps someone to save some time :)
I see some problems with the command:
Unless you have changed the default port, you should be using 8172 and not 8173.
Secondly there is a double quote before securepassword but I don't see a closing double quote.
Your package most likely has some default parameters for which you must be specifying values during deployment.
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName=https://machineA:8172/msdeploy.axd?site=app.com,UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted -setParam:paramname=value

Can SCCM deploy a VSTO add-in without using an MSI wrapper

Does anyone know if I NEED To wrap my Office 2007, vsto-based add-in in a MSI? It seems to be a lot of extra overhead and headache, just to have it not work anyway.
When I do get it to install, I still need to run the vsto installer, even though I have tried to use the |vstolocal switch to keep the add-in's deployment centralized.
Has anyone pulled this kind of install off successfully?
I've deployed VSTO from SCCM without using an MSI.
The trick is a simple command line:
"%commonprogramfiles%/microsoft shared/VSTO/10.0/VSTOInstaller.exe" /i <path to vsto>
VSTOInstaller.exe [[/install ] | [/uninstall ]] [/silent]
[/help]
/install, /i: Install the solution. This option must be followed by
the fully qualified path of a deployment manifest in the form http://,
https://, or \servername\foldername.
/uninstall, /u: Uninstall the solution. This option must be followed
by the fully qualified path of a deployment manifest in the form
http://, https://, or \servername\foldername.
/silent, /s: Install or uninstall without prompting for input or
providing information.
/help, /?: Generate this help message.
EXAMPLE: VSTOInstaller.exe /i \servername\foldername\AddIn.vsto
Be aware that with the /silent option "trust for the addin has to be built into the project or it will default to 'don't install' when using the silent switch." (source: TechNet post)
I've tried it, and you don't need to wrap it in an MSI if you're happy for users to manually install it. If you:
use the publish tab in project -> properties
setup your "publishing folder location" and "installation folder URL" properly
set and all of the other meta-data properly, including stuff in your AssemblyInfo.cs file
whack the "publish now" button
share out the installation folder and email out the link
ensure that users have the right permissions to install it (local admin I guess, you'd need to check)
It worked for me. On Windows 7 and XP too.
The whole "this publisher is untrusted" thing is a complete mess, trying to fix that involves writing some really stupid code that tells Windows that "hey, by the way, I am actually trusted". I didn't bother and just told people to ignore the warning.
I'm guessing that you only need an MSI if you want to push out the add-in using active directory and do an automated install.

Creating a file in wwwroot

I have a website hosted in IIS at location
C:/inetpub/wwwroot/sample
and there is a folder in sample
C:/inetpub/wwwroot/sample/work
I can neither read nor write a file in this work folder. I am using C# to read and write. I have set the NTFS permissions to full access, yet the problem.
Please Help
Thanks
It probably is related to a problem with ACLs, when you run it inside Visual Studio WebDev Server it runs using your identity, and if using Visual Studio in an elevated way (Vista+) then you actually might be running as administrator. When you run it in IIS it runs as a service identity, usually Network Service for IIS 6 and 7, or AppPool Identity for IIS 7 SP2 and IIS 7.5.
One thing that I would recommend is to add some tracing information to the code that is trying to write the file, for example do a try/catch where the exception is sent to trace so that you can enable tracing and determine if an exception is happening or not.
Also make sure that you are using the right physical path since you could also be having issues with relative paths, since IIS will probably resolve them to system32 if you are not using Server.MapPath or something similar.

The type or namespace name 'Script' does not exist in the namespace 'System.Web'

I just deployed a website into IIS 7 (about which I am woefully ignorant), and upon trying to build the site, I receive this error. I did a little googleing and I saw an article that said I should put system.web.extensions.dll into the /bin. But, I also saw an article saying not to do that. I tried it anyway, but I just received a different error ('Resource cannot be found').
I am totally clueless as to what else to try
Can you use the "Publish" command in Visual Studio to publish directly to the site? If not, then use that command to publish to a similar site on your machine, then copy it to the customer site.
You should also look into the IIS Web Deployment Tool. It can copy an entire site, including IIS settings and any databases. It will be built into VS2010.
Go to control panel, then programs, turn windows features on or off, scroll down to Microsoft.net framework 3.5.1 expand, make sure both sub options are selected, this might help your issue.

Resources