There is often a need to determine which application pool a w3wp.exe process is responsible for. There are separate commands for determining this in depending on the version of IIS.

IIS 6:
When running IIS 6 the following command can be used in a command prompt:

iisapp

Example output:

This process ID will match what is displayed on the Task Manager.

IIS 7:
The iisapp command will not work on IIS 7 however Microsoft provides an equivalent command:


%windir%\system32\inetsrv\appcmd.exe list wp

Example output:

This article assumes you have already installed the HTTP Redirection role. If this has not been installed follow the instructions listed here first:
Install HTTP Redirection in IIS 7

*Note: IIS creates a new web.config file or edits an existing one when a redirect is added. To avoid causing issues with an existing web.config file it is recommended to create a new site in IIS specifically for the redirect. Then the home directory for this new site can be pointed to an empty folder.

1. Open IIS and select the desired site.

2. Double click “HTTP Redirect” under the “IIS” heading.

3. Check the box next to “Redirect requests to this destination:” and enter the desired URL to redirect to.

4. Check the box next to “Redirect all requests to exact destination”

5. Choose the desired status code for the redirect. Most users choose the “Permanent (301)” as it will tell browsers the location has permanently changed. If this is something temporary like a maintenance page, select either of the other two options instead.

6. Click “Apply” under the Actions heading on the right hand side and test the new redirect.

Unfortunately the Exchange Management Console does not allow use of wildcard values for things like senders and recipients. These need to be specific user or list of users. However you can search these logs for wildcard values using the Exchange Management Shell.

Here are two examples to search for any user at example.com. These will output the results to a text file for easier viewing. Make sure to update the date ranges and domain name as needed.

Search for messages sent TO any users at example.com:

Get-MessageTrackingLog -ResultSize Unlimited -Start "5/1/2011" -End "5/12/2011" | where{$_.recipients -like "*@example.com"} | select-object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,{$_.Recipients} | export-csv C:\ExchangeLogResults.txt

Search for messages sent FROM users at example.com:

Get-MessageTrackingLog -ResultSize Unlimited -Start "5/1/2011" -End "5/12/2011" | where{$_.sender -like "*@example.com"} | select-object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,{$_.Recipients} | export-csv C:\ExchangeLogResults.txt

This information applies to Exchange 2003, 2007, and 2010.

I needed a way to be notified by email when a SQL failover occurred. The simple solution for this is to setup a job to send an email and set this job to be triggered when SQL agent starts. The SQL agent service on the passive server starts when a failover occurs.

The instructions are for SQL Server 2008 but the steps should be similar in other versions.

First we need to setup a SQL mail profile to connect to a mail server. This mail service does not need to be installed on the same server as SQL. If this is already configured skip to the “Configure the SQL job” section below.

Setup SQL mail profile:
1. Open Management Studio, connect to your SQL cluster, and expand Management

2. Double click Database Mail to start the Mail Configuration Wizard

3. Select Set up Database Mail by performing the following tasks -> Next

4. Enter a relevant profile name then hit Add next to SMTP accounts

5. Enter the email address you want to use for these alerts. I highly recommend using an existing user and enabling basic authentication. Otherwise you may have to allow the SQL server to send through your mail server without authentication.

6. Click Next -> Next -> Next -> Finish

Configure the SQL job:
1. Expand SQL Server Agent

2. Right click Jobs -> New Job

3. Fill out the General page with relevant details then click the Steps page -> New

4. Enter an appropriate name for the step and set type to Transact-SQL script (T-SQL)

5. Enter the following in the Command field. Make sure to modify the values as needed.


EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'My mail account name',
@recipients='alerts@mydomain.com',
@Body='SQL Agent has started on the passive server.',
@from_address= 'alerts@mydomain.com',
@subject='SQL Cluster Failover Alert';

6. Click OK

7. Click the Schedules page -> New

8. Name the schedule appropriately and set schedule type to “Start automatically when SQL Server Agent starts”

9. Click OK -> OK

10. Right click the new job and select “Start job at step” to test the new job and make sure it can send mail properly

It is possible to restrict access to a specific site in IIS 7 by IP address or domain. This article will cover installing the necessary role and adding allow/deny rules.

First the “IP and Domain Restrictions” Role will need to be installed:

1. Click Start -> Administrative Tools -> Server Manager

2. Expand Roles -> Add Role Services under Web Server (IIS)

3. Check the box next to IP and Domain Restrictions under the Security heading

4. Click Next -> Install

Now the restrictions can be setup through IIS:
1. Open IIS and select the site you wish to restrict

2. Under the Features View click IP Address and Domain Restrictions

3. Click Add Allow Entry and enter the IP or range you want to allow access from

4. In order to deny all other addresses click Edit Feature Settings under Actions

5. Set Access for unspecified clients to Deny -> OK

Generally this error happens when mail was hosted on the server at some point, but has since been moved to an external mail server. Qmail will still try to deliver the message locally and fail with this error:
This_address_no_longer_accepts_mail

To correct this check the following two files for the domain in question:
/var/qmail/control/rcpthosts
/var/qmail/control/virtualdomains

Remove the line with this domain from both files then restart Qmail:
/etc/init.d/qmail restart

This applies to CF 7, 8, and 9. The log settings in CF Admin only affect the standard logs such as the exception and application logs. To tweak the log rotation settings for the CF -out logs follow the steps listed below.


Logfile size:

1. First locate jrunsvc.exe typically in the CFroot\bin or CFroot\runtime\bin folder.

2. Open up a command prompt and change to this directory:
cd C:\Coldfusion8\runtime\bin

3. Run the following -logfilesize command making sure to update the values in [] accordingly:
jrunsvc.exe -logfilesize [filesize] [service_name]

Example:

jrunsvc.exe -logfilesize 1024 “ColdFusion 8 Application Server”

The command above will set the logfilesize to 1mb. Once the file reaches this size CF will create a new one.


Logfile rotation limit:

By default CF creates 200 of thes -out log files before deleting old ones. There is also a bug with the -logfileRotationLimit switch because it requires a value over 1000. So to set this you will need to make a registry change but first I recommend setting it to 1001 to allow CF to create the necessary registry key.

1. As in the example above, open a command prompt and change to the directory where jrunsvc.exe is located.

2. Issue the following command. Note you may have to change the name of the CF instance between quotes to match your setup:

jrunsvc.exe -logfileRotationLimit 1001 “ColdFusion 8 Application Server”

3. Open the registry editor by clicking Start -> Run -> regedit

4. Navigate to the following key. Note the ColdFusion path at the end will be different depending on your version:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ColdFusion 8 Application Server

5. Double click the “LogFileRotationLimit” key and change the value from 1001 to the desired number of files to keep.

The bug mentioned above will throw this error if you try to set the value to something under 1000:
jrunsvc.exe -logfileRotationLimit 50 “ColdFusion 8 Application Server”
Error: log file rotaion limit must be at least 1000

Sometimes when working with an untrusted third party root certificate Windows will automatically delete it. If Windows finds a discrepancy with an intermediate certificate on the server it will check it against their own list of approved SSL’s. If it does not match windows will remove it and log the following in the application log:

Event ID: 4108
Successful auto delete of third-party root certificate

To disable this feature and keep your root certificate installed you can do the following:
1. Click Start -> Run -> “gpedit.msc” -> OK
2. Double click Administrative Templates -> System -> Internet Communication Management -> click Internet Communication settings

3. Double click “Turn off Automatic Root Certificates Update” -> click Disabled -> OK

In order for FileZilla Server’s FTP users to be able to access files on a NAS device, a few changes are needed.

Update user that FileZilla Server runs as
First the user account that the FileZilla Server service runs as needs to be updated. By default it uses the local system account which does not exist on the NAS. Unless the NAS and server are part of an Active Directory setup, the only user that exists on the NAS is “administrator”. Create this same Administrator user in Windows on your server then follow these steps:

1. Open services (Start -> Run -> Services.msc)
2. Right click the “FileZilla Server FTP server” service and choose Properties
3. On the “Log On” tab check “This account” -> Browse -> Advanced -> Find Now -> Select “Administrator” -> OK -> OK
4. Enter the password for this user -> Confirm it -> Click OK

Setup FTP user and manually edit home directory
Next create a FTP user in FileZilla with access to a directory local to that server. Do not try to point it to a mapped drive for the NAS. Then manually set the home directory to the UNC path:

1. Stop the FileZilla Server service
2. Open “FileZilla Server.xml” in a text editor like Notepad
-Usually located here:
C:\Program Files\FileZilla Server
3. Scroll down to the username or search for it
4. Locate the “Permission Dir” field
5. Replace the local folder path with the appropriate UNC path. For instance:
\\123.456.78.90\Path\To\Files
6. Start the FileZilla Server service

Note: You will also need a FTP client which supports UNC paths. Most clients do at this point but the more basic ones won’t. FileZilla Client version 3 or newer should work fine.

I came across the following error after migrating IIS information between two servers. It turns out the old one was using IIS 7, while the new server had IIS 7.5:

===================================
IISMANAGER_ERROR_LOADING_PROVIDER_TYPE

IIS Manager could not load type ‘Microsoft.Web.Management.Iis.Rewrite.RewriteModuleProvider, Microsoft.Web.Management.Rewrite, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35’ for module provider ‘Rewrite’ that is declared in %windir%\system32\inetsrv\config\administration.config. Verify that the type is correct, and that the assembly that contains the module provider is in the Global Assembly Cache (GAC).
===================================

To clear this error and get sites working again in IIS I needed to edit the following file:

C:\Windows\System32\inetsrv\config\administration.config

Search for any instances of “7.0.0.0” and replace them with “7.5.0.0”. I had 49 occurrences of this but this was a new server so you may have even more. I recommend using an advanced text editor like Notepad++ so you can search and replace these instances quickly.

After the file is updated restart IIS and double check IIS/event viewer to be sure the error cleared.