Thursday, February 11, 2010

Configuring IIS - challenges

What is IIS? - Internet Information Service is basically a set of services for servers created by Microsoft. Lets leave out the technical details here. I would like to narrate my experience configuring IIS rather than copy-pasting information from somewhere in the Web.

Coming to my experience, why do I have to work with IIS out of the blue? I wanted to host a ASP.NET Web Service in local IIS. Thinking it is going to be easy (very very over confident I guess), I started off by enabling IIS feature under the Windows components. To do this, I had to get to Control Panel -> Enable/Disable Windows Components. Well, that was easy. Since we already have a default website, we can see something displayed when we type http://localhost/ in the address bar of the Web Browser.

Then came the part of creating a ASP.NET Web Service. Thanks to Visual Studio IDE, creating a simple Web Service that displays "Hello World" is already built-in by default when we create a new ASP.NET Web Service. This was all cool, until I hit of the "play" button or rather I did the key combination ctrl+F5. I got an error "ASP.NET 2.0 has not been configured. You will have to do this manually for the Website to run properly" (I don't remember the exact phrases :P). Now, what is this? Looks like the Visual Studio IDE has been installed before the IIS has been configured! How do I work around this? Thanks to my friend Mayur, I could figure this out. I had to get to the ASP.NET IIS registration tool (aspnet_regiis.exe). In order to execute this tool, I got to the command prompt and navigated to the directory:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Then I had to run the tool using the command

aspnet_regiis -i

This was fun...I restarted IIS and tried running the Web Service with the hope that it will work now. But no (now what?). Well, I was thrown another error. It was more like Integrated Windows Authentication has to be enabled. What in the world in this? No clue. Well, little bit of reading online told me that this had to do with client authentication to the Web Server. In order to set this, I had to open the IIS manager. I got to the IIS manager by going to Run and typing "inetmgr". Apparently, you can also get to IIS manager by going to Control Panel -> Administrative Tools -> Internet Information Services.

Once in IIS manager, I had to navigate to Default Website, right click and get to its Properties. Clicking on Directory Services tab took me to Anonymous access and authentication control (which I can edit). Clicking on edit button opens up the Authentication methods. One of the options listed is Integrated Windows Authentication. Checking this box solved the error.

I restarted IIS and found the Web Service to be working (success!).

No comments: