Friday, March 27, 2009

Troubleshooting: Silverlight and IIS 6

If you have noticed Silverlight and IIS 6 do not go well by default. When we come to think of it, din't Silverlight come a long time after Windows Server 2003? Yes, but that doesn't mean that they do not support each other totally. It's just that the MIME types needed to run Silverlight are not present by default on IIS 6. So here's how to do add them:
--> Open up IIS manager
--> Right-click Server Name
--> Properties
--> Mime Types
--> New
and add the following 3 entires one after the other:
Extension : .xap Mime Type: application/x-silverlight-app
Extension: .xaml Mime Type: application/xaml+xml
Extension: .xbap Mime Type: application/x-ms-xbap
Once done with this, you should be good to go ...
Oh by the way, you would have to do the same if you are still running the RTM version of Vista (IIS 7). From Vista SP1 onwards this was taken care by default. More info at iis.net
Have Fun!

Friday, March 20, 2009

IIS : Changes from 6 to 7

A few days back I was talking to a few Sys Admins and they asked me something, which I din’t get quite right at first attempt. Well the question was simple. We are planning to move from IIS 6 to IIS 7, could you let us know what are the differences? I told them all about how the new architecture came into place and how that benefits us. When I finally finished my talk. I realized they never wanted me to get into architecture. Their question was simple, Could you let us know what are the differences in IIS 6 and IIS 7 (As System Admins)?

That is when I understood as system administrators, knowing about the changes of the IIS 7 architecture is just the first step to understand the changes. Those of you who are still unaware of the architectural changes you might want to check the post I wrote some time back. However, this post will attempt to bring together the changes in IIS 7 with respect to IIS Installation, Configuration, Security, IIS Manager and so on.

Note: The description is brief intended only to highlight the changes.
IIS Installation:
How is it different with IIS 6 installation? Well it’s not different it’s just more customizable. IIS 7 is broken down into more than 40 modules, which, can be selected depending on the configuration you want for your server. If there is a dependency for a particular module, that will be auto-selected by the setup process. Within Windows Vista IIS 7 can be installed from Turn windows Features on\off from the control panel and from Windows Server 2008 you can install the Web Server Role through the Server Manager.

IIS Configuration System:
The configuration system within IIS 7 has evolved from the flat property description as in IIS 6 to a much structured and easier to understand. IIS 6 used Metabase.xml file within %windir%\system32\inetsrv as its configuration store. IIS 6 Metabase compatibility has been maintained but focus should be paid on the new configuration as the changes it brings can really help you get going quickly. If you are familiar with the .Net configuration system then understanding the new IIS configuration will be much easier. The new files that you should be aware of regarding IIS configuration are:
At the root (or global) level, there are two separate files:
· system32\inetsrv\applicationHost.config: Holds the global defaults for web server (IIS) settings.
· \windows\microsoft.net\framework\v2.0.50727\config\machine.config: Holds the global defaults for the .NET framework settings, including some of the ASP.NET ones (the rest of them are in the web.config at the same folder, which is sometimes called the root web.config)
Apart from this, in the web content directories, there may be optional web.config files. These can be used to control the features for their level and downwards.

Security:
IIS 6 is known for it's by default lockdown and it has done wonders for a lot of system administrators. In regard to IIS 7 a lot of changes in the security model of the web server is in direct relation to the changes of it's core architecture itself. In IIS 6, security was performed in a dual-mode when dealing with ASP. Thanks to the new integrated pipeline structure within IIS 7, authentication and authorisation is taken up just once. For a clear understanding you could refer my previous post on IIS 7 architecture.
Additionally, IIS 7 brings in the new feature of Delegated Administration. Using delegated administration you could allow changes of certain levels to non-admin users. To top it, these users could be both Windows and non-Windows (local IIS users). For example, you could now make a user, administrator for a particular web server or website. This user does not have to be the administrator of the box. How cool is that for a change!
All previous forms of Authentication schemes are support on IIS 7 with Passport Authentication being the only exception. For details on how security schemes have changed in IIS 7 read the article on IIS.Net

IIS Manager:
IIS manager is be far my favorite change in IIS 7 not that I dint like it's IIS 6 UI but this is much cooler and user friendly. IIS manager has been built into it's familiar tree view on the left hand corner. The center pane can now be used to see what is know as the "content view" and the "features view". Content view shows you the content that the selected application or the virtual directory holds and the feautres view shows the available features for that selected virtual directory. And at the right hand corner you would find this very helpful set of commands available for the selected attribute.

This was just to get you started. Hope this helps!

Thursday, March 19, 2009

I am Back!

It's been long time I haven't been around. I was really busy with my current profile (interesting work you see!). Meanwhile lot of developement has taken place in the community around - new version with Win7 beta, lots of new extensions, lots of issues resolved. I will be covering more of this in the near future. But just to pump ourselves into momentum, I have collected few IIS Kb's that are interesting. Take a look at them.
Note: These are just part of my collection so they are pretty much related to IIS 5.0,5.1,6.0,7.0

Hope it helps:

321141 How To Disable or Remove Unnecessary IIS Services
309506 How To Perform an Unattended Installation of IIS 6.0
950573 FIX: Application domains restart unexpectedly in Internet Information Services 7.0
954874 IIS binds to all IP addresses on a server when you install IIS 7.0 on Windows Server 2008
954872 How to create and manage configuration backups in Internet Information Services 7.0
954756 You experience issues when you host a Web application that contains lots of ASP files in IIS
954857 The Windows Process Activation Service and the World Wide Web Publishing Service are set to a Stopped state after you install the .NET Framework 3.5 on a Windows Vista-based computer
954873 You may experience slow performance when you use Integrated Windows authentication together with the Kerberos authentication protocol in IIS 7.0
954847 IIS 6.0 returns path information that is incorrect when you use the WebDAV PROPFIND method
954755 How to configure intermediate certificates on a computer that is running IIS for server authentication
954856 BUG: You cannot install or uninstall a component in IIS 7.0
954875 An error message is displayed when you try to create a new application pool in Internet Information Services 7.0
954839 Events 4505 and 4506 are logged in the Security log when you turn on the metabase auditing feature in Internet Information Services 6.0
954841 Error message when you browse IIS 6.0 content in Internet Explorer: "The data is invalid"
941850 When you try to access files on a WebDAV site that uses only Digest authentication, the process may fail on a Windows Vista-based computer
942039 FIX: Visual Studio 2005 incorrectly creates a subfolder and moves a Web project to the newly created folder

How To: IIS and Log Parser 2.2

As IIS administrators we come across many scenarios wherein we are asked to analyse the overall performance of a web server. There are various steps involved in it, however, analysing IIS log files without a proper tool can be a pain. It's very easy to get lost in the lines. Log Parser is a tool that I rely upon when it comes to manual IIS log file analysis. It's a cool tool that provides universal query access to text-based data, such as .log files. Log Parser can be downloaded from here.

With this version, we can parse various files types, however, in our scenario we wil be using Log parser against IIS log files.

1.) After downloading the installation package, double-click on installation file and follow the on-screen instruction to set up log parser on your machine.


2.) Open the working directory of Log Parser post installation. Copy logparser.exe and logparser.dll and paste it into your IIS log file directory.
Note: At default installation, Log Parser is installed at “C:\Program Files\Log Parser 2.2”. we are doing this copy-paste only for operational easiness.


3.) Open a new command prompt window and type

> cd "log file directory" --> Enter
> logparser.exe -i:IISW3C “SELECT cs-uri-stem as [Request URI], COUNT(*) AS Hits INTO hits.csv FROM ex*.log GROUP BY cs-uri-stem Order by Hits desc” –q:off --> Enter
The above query into log parser will return a CSV file named hits into the log directory. This CSV file gives the most used pages on the web server. This excel sheet can then be formatted to suit the needs of your operation.

> logparser.exe -i:IISW3C “Select Top 20 LogRow as [Line Number], date as [Date], time as [Time], c-ip as [Client-IP], s-ip as [Server IP], s-port as [Server Port], cs-method as [Request Verb], cs-uri-stem as [Request URI], sc-bytes as [Bytes sent], sc-status as [Status], sc-substatus as [Sub-status], sc-win32-status as [Win 32 Status], time-taken as [Time Taken] Into sqlout.csv From ex*.log Order by time-taken desc” –q:off -->Enter

The above Query into log parser will return the 20 slowest pages running from the web server. The above query will create an csv file named sqlout.csv which can again be formatted to gain the required output result.

The above 2 queries will give us sufficient data to start analyzing performance issues on the server related to IIS and pages running from the server. In case for more information and help:

> logparser.exe --> Enter

Note: Make sure that all the values that you would like to obtain through LogParser are actually selected in the IIS website configuration.

For more information, check out the ScriptCenter tools link. For issues and being up to date check out the Log Parser Forums

Let me know for more information.