IIS tips and tricks

Running multiple versions of the .NET framework in IIS

When you install a new .NET framework in your IIS server some applications can stop working showing you the following error:

Server Application Unavailable

 

In the event viewer you will find this:

It is not possible to run two different versions of ASP.NET in
the same IIS process. Please use the IIS Administration Tool to
reconfigure your server to run the application in a separate process.

 

This happens because different .NET frameworks can run in the same server, but cannot share the same application pool, so, to solve this:

  1. In IIS Manager (Control Panel > Administrative Tools) create a new Application Pool (using default values is ok).
  2. In Default Web Site right click your application folder and select Properties.
  3. In the Virtual Directory page, in Application Settings click the Create button and write a name for your application (you can use the recommended name). In the Application Pool list select the application pool you just created.
  4. In the ASP.NET page select the framework version you want to use.
  5. Press the Ok button and voila!, go and enjoy!
 
 

The IUSR account

IIS will by default install a couple accounts in your system: IUSR and IWAM. IUSR is in charge of all anonymous requests. So, to give anonymous access to a folder, file, asp, etc. you must ensure the IUSR account has read (and execute for asp’s) permissions.

 

Firefox cannot load “localhost”, while IE can

I installed IIS on a reformatted computer and when trying to access the home page using Firefox I was asked for my username and password. After many tries and permission checkings (check this first!) I used IE and it worked… I googled a little bit and found this solution:

  1. Open up Firefox and type in about:config as the url
  2. In the Filter type ntlm
  3. Double click “network.automatic-ntlm-auth.trusted-uris” and type localhost and hit enter

After I did that everything worked ok.

 

Installing PHP in few steps

  1. Download PHP (no installer version)
  2. Unzip it to C:Inetpubphp
  3. Add read and execute permissions on this folder to the IUSR account
  4. Open php.ini-recommended (located inside C:Inetpubphp)
  5. Set display_errors to On
  6. Set extension_dir = “C:Inetpubphpext”. It must point to your extensions folder
  7. Remove the # for any module you might need (ie: mysql)
  8. Save this file as C:Windowsphp.ini
  9. Add C:Inetpubphp and C:Inetpubphpext folders to the your PATH (Control Panel > System > Advanced > Environment Variables > System Variables). If you skip this step some DLL’s (like MySQL) will not be loaded!
  10. Open the IIS Administrator
  11. Right click on your website and select Properties. Select Home Directory. Click on Configuration. Click on Add. Click on Browse and select “php5isapi.dll” located in your php folder. Write .php in the extension box and click Ok. Click Ok, and click ok again.
 

Restarting IIS

To completely restart the IIS services it is not enough to press the restart button from the IIS Admin Console. You have to restart all the related services.

You can accomplish this by typing the following commands in a Windows Console:

net stop iisadmin
net start w3svc

 

Nice coding.

One Reply to “IIS tips and tricks”

  1. Good Work, Pointing out that scads of non-identified corporate in-house servers run IIS; that it, too, is a free server (as it comes with the operating system); or that there are in fact plenty of cool add-ons for IIS (including many that provide source code) does little to dissuade these server chauvinists from their opinion.

Leave a Reply