Saturday, May 31, 2008

My laptop :: My Mean Machine

Finally, I have got the time to give myself an explanation as to why I haven't been blogging for almost a month???

Well....For a long time now I was a writer without a pen and paper... I dint have my Laptop ;)
Suddenly live felt strange, office seemed better with all the systems nearby... :)

But now, I am back to normal... :D

Just bought myself a brand new piece ... My Mean Machine...I believed it would be simply Just to put down my first entry on this achievement. So here it goes:

What makes it a Mean Machine?

  • Compaq Presario C700
  • Intel Pentium Dual Core 1.7GHz
  • 3GB DDR2 RAM
  • 15.4 Widescreen
  • Integrated wireless, bluetooth & webcam
  • 160Gb Sata Hard Drive
  • I have another 500Gb My Book that I use for storing all my content so 160Gb was sufficient enough for the Laptop
  • Apart from this all the other stuff that a Laptop requires.
Got Windows XP SP2 up and running along with a VPC session of Windows Server 2008 Evaluation Copy ... Well don't know how long that's gonna last ;(

Oh that reminds me.. I have already started work on An Introduction to IIS 7 PowerShell Provider - Part 3

Just in case you didn't read the first two parts. You can read them at:
An Introduction to IIS 7 PowerShell Provider - Part1
An Introduction to IIS 7 PowerShell Provider - Part 2

Software Tech:

  • Microsoft Office (more of a necessity than a luxury)
  • Microsoft Visual C# Express Edition
  • IIS 7 (Of Course!) on my evaluation copy of server 2008.
  • PowerShell along with the IIS 7 PowerShell Provider
  • Another Small Setup of Apache 2.x along with PHP 5 and My SQL. Long time association. Just can't get rid of it.
Involvements:
  • Just completed a fairly simple and small HTTP module for IIS 7 on the new setup. Great feeling right from the 1st time I heard about this feature. Which feature am I talking about?
Well in IIS7, you can now build your own custom HTTP Module and integrate it along with the core server engine. Sounds good eh? Not over yet, It works even better :) ... but more of that later.

As always do let me know if you have any questions to any of the related topics or anything that you fancy in IIS.



Sunday, May 11, 2008

Silverlight 2.0 in Action

Silverlight has now existed for quite sometime, but, I came to know the real power of Silverlight when it was showcased in MIX 2008 this march. There were some real cool apps that were shown running on Silverlight 2.0. One of the most exciting of them was the NBC website for Olympics that has been developed in Silverlight and will eventually be hosted on IIS 7. Boy! you really should check that website once it's out in the open. The media and data streaming is enhanced hugely with Silverlight along with cool features of IIS 7 media bit throttling. This will soon be giving us some real good pictures of the coming Olympics (controversy or no controversy, This one's good!)

Well anyways after MIX '08 I din't get to see any cool silverlight apps out in action ... Until I came accross http://bigweekend.external.bbc.co.uk/ while surfing on the net. I thought there was no better chance than this to show all you people how great user expirience can be made by using Silverlight 2.0.

The real picture that is being used in this app is the one just below.
Now if you take a careful look, you will notice that I have marked the numbers 1 & 2 in red. The numbers are not very well formatted, but, you need to give me credit as i am writing this blog at 4 in the morning ;).Well those are the 2 spots that I wanted to zoom into. Why?? hmmm just for the heck of it. Well it turns out not really. I wanted to check as to how much I could actually zoom into this Silverlight application, to try and figure out the real power out of this technology. The picture that I have attached is pretty small and not of real resolution & size. If you want to take a look at the real thing go check it out at http://bigweekend.external.bbc.co.uk/. At first if you do not have silverlight installed, the application will not be loaded up instead you will be notified to install Silverlight 2.0 plugin into your browser. You should know that Silverlight is still in it's Beta phase so I am not sure if it will work at all conditions, however, I have tried this on Firefox and IE 7, it works just fine. But , enough of this, the cool thing is what happens when I zoom to the location 1 & 2? Check the pictures below for the result.














As you can see the number that you see is the picture at the left is that of the car where in I have marked 1. And the picture that showcases all the artist is the place where I have marked the 2 in the main picture. More important, keep in check the speed at which you are able to perform these actions. It's real quick!!

This is just one out of some many examples that are already being worked upon by Silverlight 2.0. If you think that it's good enough to be experienced, below are some of the most important links to the Silverlight World!

  • Install Microsoft Silverlight 2.0 from here
  • Website for beginners, advanced and experts - Silverlight.net - This is a great resource if you want to hit it off bigtime with Silverlight.
  • To check out the sessions held on Silverlight during MIX '08 visit here

BTW I love the Silverlight slogan - Light Up The Web ;)

As Always, do write in your comments and let me know if you need anymore info on this subject.

Saturday, May 10, 2008

Difference between Virtual Directory and an Application in IIS

After a lot of work I finally have the time now to write a useful entry. Almost all the times I have spoken on IIS, I have had an audience who asked me these basic questions.

Q.)What is the difference between Virtual Directory and Virtual Application
Q.)How is ASP and ASP.NET processed within IIS.

Although they are conceptually and functionally different,yet they tend to arise a very reasonable confusion in the mind. So I thought to put the answer down in writing.

Lets take them one by one.

Q.)What is the difference between Virtual Directory and Virtual Application

Before we dig deep into the difference lets go through the definitions:

Virtual Directory is the path that you specify in IIS which maps to the physical location of the content. This path then becomes the part of the URL.

An Application in IIS 6 is a virtual directory which contains some or more of the application pool properties.This again becomes the part of the website URL.

For example, if you have a static file named start.htm which is contained inside a folder named example. When you map example to a website within IIS, it becomes a Virtual Directory. After that, once you associate an application pool to this virtual directory it becomes an Application. But, this was within IIS 6.

With IIS 6 as prospective in mind, the concept is pretty confusing as the difference is not that major. In IIS 6, the basic purpose for this feature was application isolation. Other than this , however, it provided the developers to make complex applications by using the extended feature within ASP and ASP.Net applications.

In IIS 7 however this is pretty different, for the good :)

For IIS 7, Application and Virtual Directory are two different objects and are different parts of the website hierarchy. Within IIS 7, every site must contain an application which will in turn contain one or more virtual directory.

An Application here is a group of files that delivers content or provides services over protocols, such as HTTP.When you create and application it is not only a part of sites but is now also mapped to an Application Pool.

The difference is more apparent when we bring in ASP.Net into the picture, as we will then have to consider the runtime component at the server. At runtime when an ASP.Net application request is received, a new AppDomain is created in the worker process that handles subsequent ASP.NET requests. Therefore, an application can have several virtual directories, and each one will be served by the same AppDomain because of the integrated pipeline structure of IIS 7.

But again you can have a set of Applications and virtual directories with in a single site. Atlast, it only depends on how you plan it out. I would recommend, the static content files to be a part of the virtual directory structure and the dynamic content which may or may not include aspx pages to be part of the application structure within a site.

Q.)How is ASP and ASP.NET processed within IIS.

Well this is a very good question, because the answer of this questions also gives you a very sound surface touch of the IIS processing model.

The description below is how ASP and ASP.Net is processed under IIS6. This process model is now pretty different in the case of IIS 7.

When a request is made by the user for an ASP page, IIS checks the given URL, determines the actual resource name, extension.

Since you have the general extension as .asp for asp web pages IIS maps that request to asp.dll. ASP.dll will process the page and return the HTML equivalent to IIS, which is then sent to the browser.

asp.dll is located at %windir%\system32\inetsrv

Oh BTW, for the beginners, if you come across the word Classic ASP (which is more or less now a standard representation.) it stand for ASP but not ASP.Net. ;)

As for ASP.NET the processing a bit more complex.... you have the general extension as .aspx for asp.net web pages, IIS maps that request to aspnet_isapi.dll. Aspnet_isapi.dll will process the page and return the HTML equivalent to IIS, which is then sent to the browser. However, for the sake of easy understanding, I have not included many features with in ASP.Net processing.

Well I leave it at this, lets see where you would want me to take it. Do put in your comments/questions as always.

Sunday, May 4, 2008

An Introduction to IIS 7 PowerShell Provider-Part 2

Continuing our discussion on IIS 7 PowerShell Provider(Didn't read part 1... Check it out at An Introduction to PowerShell Provider for IIS 7 -Part 1), I will be telling you now about the various methods and commands for adding, managing, and deleting IIS websites settings.

Before we hit off with all the funda.. Lets make the appearance of our IIS PowerShell Management Console look similar to that of the usual PowerShell window...

To do this go to the console window->right-click properties ->Colors and enter the below RGB values.

The RGB values for the Screen Background are (1,36,86) and that of the screen text are (238,237,240) ... There we go ... everything looks like the normal PowerShell HUh!!OK Lets start with some real work now...

The 1st thing that I would like to do before we make any change is to know what are the existing websites currently configured...

To get that type this in :

PS IIS:\> Get-ChildItem sites
The Get-Childitem cmdlet gets the items in one or more specified locations. The item would in this case be "sites",which is a container.When Get-Childitem cmdlet is used PowerShell will display all the items inside the current container. As Simple as that!To sum up, output of the command above will list all the websites contained within the sites container. Along with the name, it lists the current state of the sites, id, bindings, and the physical path. Just in case you want to have that saved in a text file ...go for
PS IIS:\> Get-ChildItem sites >c:\sites.txt
FYI, mentioning c:\ before infotxt is necessary, hope that is obvious enough to everyone as we are currently working from the IIS drive. Anyway's, c:\ can be replaced with any drive partition of your choice.

-->To add a new website, type this in

New-Item iis:\Sites\NewWebsite -bindings @{protocol="http";bindingInformation=":80:NewWebsite"} -physicalPath c:\NewWebsite
If you check out your applicationHostconfig (%systemdrive%\Windows\System32\inetsrv\config) now, you will find that the below code is added.

<site name="NewWebsite" id="3" ServerAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="c:\NewWebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:NewWebsite" />
</bindings>
</site>
Your site will now be listed in IIS Manager, although you might have to refresh IIS Manager in a few cases if it was already open. However, the above command WILL NOT create c:\NewWebsite if it is not present. You can also custom configure "id" of the website, all you got to do is add the -id parameter at the last of the New-Item command along with the id that you wish. If there is duplication in any of the parameters, PowerShell will not continue and throws an error along with the reason.

Lets continue and quickly create a new application in our NewWebsite. Here's how you do it:

PS IIS:\> New-Item IIS:\Sites\NewWebsite\NewApp -physicalPath c:\NewWebsite -type
Follow up on how we are using the New-Item cmdlet to create different items within IIS. Again you need to remember that it will not check if there is any folder or content that is actually present at the physical location. Why is that?

Well, here is why. Because New-Item creates a new item in a namespace. The type of items that can be created depends upon the Windows PowerShell provider used. The provider we are dealing with is IIS7 Provider.

ApplicationHost.config will now have the following section added under the site tag for the NewWebsite section.

<application path="/NewApp">
<virtualDirectory path="/" physicalPath="c:\NewWebsite" />
</application>

To create a Virtual directory just interchange the type from Application to VirtualDirectory in the above command.

But what is the difference between an Application and a Virtual Directory? This is something that I have been asked a lot of times. So, finally here comes the answer in writing ;)

An application is a unit that contains files within single or multiple virtual directories that works over different protocols to provide various web services. On the other hand, a virtual directory is a file directory is that contains various content files for a website.

If you want more info on this, check these out

-->Did all that sound confusing?? No problem, let's get to the simpler world now

What about application pools one may ask. Simple:

PS IIS:\> new-item AppPools\NewAppPool
Next, removing a website is even simpler than adding a website. All you got to do is,

Remove-Item iis:\Sites\"Name of the Website to be removed"

and that's it. However, you will have to remove the content manually, that will not be taken care by the above command.

Ok that is it for Part 2, keeping checking as I will soon come out with part 3 and more interesting stuff.

If you have any questions or comments... please do write it down and I will try to answer them asap.