Delete .Net Temp files.

A short script to delete .Net temp files:

@ECHO OFF

iisreset /stop

Echo Deleting x86 Temporary ASP.NET Files

for /d %%i in ("%systemroot%\Microsoft.Net\Framework\v*") do for /d %%f in ("%%i\Temporary ASP.NET Files\*") do RD /q/s "%%f"

Echo Deleting x64 Temporary ASP.NET Files
for /d %%i in ("%systemroot%\Microsoft.Net\Framework64\v*") do for /d %%f in ("%%i\Temporary ASP.NET Files\*") do RD /q/s "%%f"

iisreset /start

How to duplicate an IIS7 configuration

Export IIS7 Config
TWEB is the Destination web server.
SWEB is the Source web server.
First, on TWEB make a backup copy of the files in C:\Windows\System32\inetsrv\config.  I just created a subfolder called “bak” and copied them.  This is very important.  If you forget or skip this step because backups are for sissies, you will be re-installing IIS7 in step 4.
 
Second, copy the AppliationHost.config from SWEB into the C:\Windows\System32\inetsrv\config folder on TWEB.  Also copy any application files like your c:\websites folder or whatever over to TWEB in the appropriate location if you haven’t already.
 
Third, on TWEB open both the new ApplicationHost.config and the backup ApplicationHost.config from step 1 and locate the <configProtectedData> node in the backup.  Copy that node and replace it into the new config file.
 
Fourth, if you didn’t backup the existing config file, remove the IIS role and add it back, then start at step 1.

Explanation of Classic vs. Integrated mode in IIS 7.x

Classic mode is where IIS only works with ISAPI extensions and ISAPI filters directly. This is how IIS 6 and below behaved. Using classic mode, ASP.NET is simply an ISAPI extension (aspnet_isapi.dll) and an ISAPI filter (aspnet_filter.dll). When using classic mode the server uses two piplines to handle requests, one for native code and the other for managed code. In this mode the application doesn’t take full advantage of everything IIS 7.X has to offer.
Integrated mode handles all requests through a unified pipeline for IIS and is tightly integrated with ASP.NET through that same pipeline. ASP.NET sees every relevant request and manipulates things along the way rather than acting as an external plugin. With integrated mode ASP.NET runs much more efficiently in IIS and will yield greater performance for your site.

 

Some legacy code may require that you run in classic mode to execute without error. To take full advantage of IIS we strongly encourage you to review your code if your application throws an error in Integrated but runs fine in Classic.

Installing RiaServices on a Server

Visual Studio and the Silverlight SDK are two dependancies that are needed for the installation of RiaServices. If you are dep[loying this package to a server with IIS7.5, these dependancies do not need to be installed. To install RiaServices.msi on the server, use the following command:

 

msiexec /i RiaServices.msi SERVER=TRUE

Inserting client-ip into IIS Logs

Since the IIS instances are behind load balancers, the load balancer IP is inserted as the client-ip. To work around this, an IIS module is needed that replaces the client-ip value with the correct value. This is acomplished with two changes. First, the ACE must inject a speacial header value. In this case the header value is X-Client-IP. Second, the arr_helper module has to be installed and configured to replace the client-ip value with the correct value.

The module can be found here:

http://blogs.iis.net/anilr/archive/2009/03/03/client-ip-not-logged-on-content-server-when-using-arr.aspx

The module is installed in:

%PROGRAMFILES%\IIS\ARR Helper\​

The configuration is located in:

%windir%\system32\inetsrv\config\schema\arr_helper_schema.xml