App Domains and Web Applications

Posted In Tutorials - By NitiN Kumar Jain On Friday, July 11th, 2008 With 4 Comments

Pin It

Today while working on installation of a web service, I faced a very unusual problem.

We had configured a Windows SharePoint Services 3.0 (WSS) site on one of our Windows 2003 server. And on the same server I had to install a web service that I was supposed to use from my PC in the same LAN. The same web service was installed on the server before also but somebody might have uninstalled it. I installed the web service in the Default Web Site location. After installing it, I checked it on local host and it worked okay. I came back to my system and tried using it from the URL that should be working. And to my surprise, it did not work. It threw some server error and asked me to change the Custom error mode to off in the web config to allow me to see the actual error. I went back to the system changed the mode but the error did not change on my PC.

It was a shocker to me and time was running out. I went back to server and checked the web config again but it never worked. I was getting aggravated now. After doing some more r&d, all in vain, then I discussed it with one of my senior. He went to check the event viewer to see why was the problem. And it was revealed that the service when accessed using the system name, points to some other web service in some other application domain.

!!App domains!! I had read a lot about it but have never practically seen them or played with them. So it would be a new learning. I thought. I reminded myself “Application domain is a mechanism wherein the different software applications are executed independent of one other without affecting each other”.

I searched the app domain that the service was pointing to in INETMGR and came to know that the web service used to exist there before but after uninstalling did not remove it from that app domain. Why? I asked myself. I should have got the answer by Googling but I was short of time. I tried removing the service from that app domain and after couple of IIS resets and refreshes I did it.

I ran the service from my system again but grrrrrrrrrrrr :(  this time it displayed the sharepoint error page. Sharepoint, how come it came into picture. Again have no idea. Tried searching my service in the app domain of the sharepoint site and could not find it there. I then searched the whole registry but no such occurrences of the service any where. Then how came that sharepoint site was taking the precedence while accessing the web service??

Some hit and trial – I stopped the sharepoint site and then again tried and it worked hurrrrrrraahhh 🙂 But could not get why stopping the sharepoint site let it to work.

I uninstalled the service from the server and searched it in all app domains and it nowhere existed.

But I needed that sharepoint site also so I just couldn’t stop it and work. I had already wasted half a day and was running short so I decided to delete that sharepoint site, do some cleanup in INETMGR (deleted unwanted domains and websites) and reinstall the sharepoint site.

After all that, both my sharepoint site and web service worked but I would definitely like to know the real cause of this issue. May be in next couple of days when I would less burdened, I would do so.

If anyone of you know the cause then do let me know.