Caveman's Blog

My commitment to learning.

Posts Tagged ‘IIS

Creating multiple websites on IIS 5.0 + Win XP

leave a comment »

Some time back I was using windows XP Pro for development at work. One thing that I was unable to figure out was to create one website per project with in IIS. The answer to this is that there isn’t a way to accomplish this using the IIS Management Console. I did some searching on the web and found a couple of awesome free tools that serves the purpose.

XP PRO IIS Admin [1] and IISAdmin.Net [2] are of tremendous help with setting up and allowing you to easily add new websites, and switch between them. One thing to keep in mind is that we can only have one active website at a time. I wonder why microsoft left out on this feature from the IIS mmc.

1. IIsAdmin.NET: Create Multiple Web Sites Under Windows XP by Mark Belles, Gabe Wishnie

2. XP Pro IIS Admin by JetStat

Written by cavemansblog

February 14, 2011 at 2:03 pm

Why is my web application slow?

with 10 comments

Web application slowness in different environments in a software factory-line is something that we all must have come-across at some point or the other. Here is my perspective on “where to begin” to address this issue in a general sense for a Microsoft centric web application. Let as assume that our application was developed using ASP.Net and a SQL Server database.

Web Server

1. Go though the Event Viewer log for any errors, warnings and informational messages. Watch out for messages that were logged by your application and another other applications on your web server.

2. Check the IIS logs to see if there is any unusual response rate i.e. errors (http 500, 404, etc).

3. The application pool in IIS can be a source of the slowness of the application.

4. The web server could have ran out of disk space (lack of error log rolling and backup service).

5. IIS crash because of a memory leak, thread locking, etc. Check out Troubleshooting an IIS Crash/Hang

6. JavaScript interaction with UI objects (Flash, Applets, Silverlight).

7. Make sure that the web server is up-to-date with all the latest “software patches” 😉 (oops !!!  service packs)

8. Make sure that the database connection pool settings are correct.

9. Consider rendering the website content using a content delivery network (CDN) service provider like Akamai, Amazon CloudFront, Microsoft Azure, AT&T, etc.

10. If none of the above seems to cause an issue then read-on.

Application Code

1. Analyzing the web request and the web response across multiple pages of the application using tools like Charles, Fiddler, Firebug, etc can provide you lot of information that you would not know otherwise.

2. Narrow down the scope of the slowness in the page execution.

3. Not disposing objects after use can eat up lot of resources on the web server causing the slowness.

4. Make sure that the response times of all the Ajax, web service calls  are in line with the expectations.

5. Run extended load tests to determine if there might be a new cause of failure, that might not have been noticed during regular load tests.

6. Always employ best practices for implementing web site acceleration [1].

7. Consider fetching multiple result sets in one database call as opposed to one result set per database call. This will reduce the number of round trips to the database.

8. If none of the above seems to cause an issue then read-on.


1. Low disk space on the SQL Server/Cluster.

2. Not following SQL Server best practices.

3. Go though the execution plans of the various suspect SQL scripts/statements to isolate the issue. Table scan can be a very costly operation as opposed to a index scan.

4. Run a SQL Trace for a few hours in an environment with lot of traffic and feed the trace file to the SQL Server Performance Tuning wizard.

5. Apply the recommendations of the SQL Server Performance Tuning wizard to the database to see if that helps.

6. Verify and make sure that the background SQL, SSIS and SSRS tasks are scheduled to run during off-peak hours.

7. Considering breaking down a huge database into smaller ones. as an example an e-commerce website should be accessing data from a Catalog, Marketing, Sales and Audit databases instead of one big database.

8. Consider regular archiving and cleanup of historical data from all databases.

9. Index defragmenting [2] can improve the SQL execution times too.

10. Sorting of huge record sets might be best left to he done at the application level than at the database level. This could be controversial depending on who you speak to. With this kind of a solution chances are that a modern day beefed-up web server in a web farm(load balanced environment) should be able to handle expensive data operations. This would conserve SQL Server processing time to handle more requests.

11. I hope your issue might have been resolved by now.

I will update this blog, as and when I can think of other ways to help the cause.

Good luck and happy programing !

kick it on

Also find this post on


1. Cost-effective website acceleration

2. Microsoft SQL Server 2000 Index Defragmentation Best Practices

Prevent Internal IP address disclosure

with 2 comments

One of the vulnerability that we had to fix on a recent project was the disclosure of the IP address when IIS had to redirect a web request to another page and here is how it got fixed.

Based on the following Microsoft support article: “FIX: IP address is revealed in the content-location field in the TCP header in IIS 6.0” [1]; follow these steps to set the SetHostName property in IIS, so that the System Admin defined hostname is revealed in the response header as opposed to the internal IP address..

  1. Click Start, click Run, type cmd, and then click OK to open a command prompt.
  2. Change to the folder where the Adsutil.vbs tool is located. By default, this folder is the following:
    • %SYSTEMROOT%\Inetpub\AdminScripts
  3. Type the following command, where x is your site identifier and hostname is the alternate host name that you want to use:
    • cscript adsutil.vbs set w3svc/x/SetHostName hostname
    • X can be looked by from IIS mmc. Click here [2] to know to look up the site identifier.

    If this does not fix the problem then try installing the latest service pack for Windows Server 2003 and then restart your computer


    1. Microsoft Support: FIX: IP address is revealed in the content-location field in the TCP header in IIS 6.0
    2. Chris Crowe’s Blog – IIS Web Site Identifiers.

Written by cavemansblog

November 4, 2009 at 3:39 pm

Posted in IIS

Tagged with ,

IIS – Internal Server Error, Class not registered

with 6 comments

On one of the Win XP Professional machines IIS was throwing an Internal Server Error. When I checked the Event Viewer, there was a “Class not Registered” error and following was the content of the event:

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 36
Description: The server failed to load application ‘/LM/W3SVC/1/ROOT. The error was ‘Class not registered’.

Bare bones: ASP and ASPX pages were not being recognised and http 500 error was returned to the browser.

I was able to google my way to the fix on Bernard’s MSMVP blog and God it made my day. Here is the working solution, its not my solution but I felt the need to document it and to share.

I was able to fix this issue following these steps:

1) Open Command Prompt and type “cd \windows\system32\inetsrv”
2) Run “msdtc -resetlog”
3) Run “rundll32 wamreg.dll, CreateIISPackage”
4) Run “regsvr32 asptxn.dll”
5) Run “iisreset”
6) Reboot…

1. The famous ‘Class not registered’ – Bernard’s MSMVP Blog

Written by cavemansblog

June 23, 2008 at 8:58 pm

Posted in IIS, Sudheer Reddy Battula

Tagged with , , ,

Troubleshooting an IIS Crash/Hang

with 2 comments

This is an experience of mine at a client. It was a project about integrating a third party application with the client’s web application, so that the client could provide better service to its customers.

I have designed and implemented this ASP integration application and the project was deployed successfully. Everyone was very impressed with my work and I was happy.

I was thinking how well my design was and that all implementations should be as good as mine. how nice would it be if all the systems that are designed and implemented ran smoothly after a successful QA, with out ever crashing or needing any monitoring.

Phone rings !!!!

Wake up Caveman!!! Wake up !!! Ohhhhhhhh Shoot!! it was only a dreammmm….. damn-it!!

I woke up from my dream with the annoying ring of the phone. I got this call from the support group

Me: Hello, Me here

Support Guy(SG): Hi this is SG from the Support group, how are you?

Me: Good, How about you?

SG: alrite

Me: What’s up?

SG: The website is hanging intermittently and we are having to do an IISReset to bring back the site.

Me: hmm… Is there a pattern to this issue?

SG: The CSR Manager said that this happens randomly and that the business is getting effected because of the outage.

Me: Okay I will take a look at this and get back to you.

SG: This priority 1 issue.

Me: (I thought of shouting at him: so what!!! hold on !!! I will get to it when I can get to it) Thanks for letting me know about this…. and the call ends.

This is the time when I was scratching my head about what could possibly have gone wrong, that caused the website to hang. My first instinct told me that the third party component might be the culprit (as later turned out to be), coz I did not design/code it, heheheheeeee.

There could be several reasons like some of the following that could cause an application failure.

1. Network Issues.
2. Too many database connections.
3. Unreasonable CPU utilization.
4. Disk access errors.
5. Web Service failures.
6. Erroneous third party components.
7. Memory Leaks.
8. Threading issues, etc…

I would usually start with checking the health of the Web application that includes (but not limited to) checking the following:

  • No. of Database Connections.
  • CPU on Web Server and Database Servers..
  • Event viewers on all servers.
  • Memory consumed by Dllhosts or Worker (w3wp.exe) processes.
  • Web Service call durations.


At times this might also not help and all you would notice is a blip on the radar that does not tell you much, like an iisreset has been automated and that a crash has occurred. How would you know the cause of the crash/hang?

IIS State is a command line utility, that is a part of the IIS 6.0 Resource toolkit, that is a very handy to diagnize IIS related issues.To attach IISState to a particular w3wp.exe process execute the following command (where <PID> is the Process ID). This will do an immediate dump of the current process.

iisstate -p <PID>

IISState also supports the following optional switches:
  • -sc(waits for a “soft crash” such as an ASP 0115 Trappable Error Occured in an External Object)
  • -hc (waits for a “hard crash” where the process terminates unexpectedly)
  • -d(write out a dump file, which can be used for further analysis, e.g. by WinDBG)

IISState outputs a log file containing the stacks of all the threads in the process. I used the IISState utility to get a dump file and a logfile by hooking it to the only w3wp.exe process. I got lucky and the crash happened in a little time. Upon examining the dump I have noticed that the one of the threads was waiting on another thread to get its job done and that, that thread was waiting on another thread. I traversed through a bunch of threads to finally derive at a thread that was the culprit. I was able to figure out that this thread belonged to a third part dll as mentioned in the thread info. I have checked with the 3rd part software company and found out that they had released a newer version that took care of the thread issue.

Another way of diagnosing the issue would be by further analyzing the dump file with utility like DebugDiag, WinDBG. For this method of diagnosis you will need the .pdb files of the application and the necessary symbols.

Useful tools:
1. IIS 6.0 Resource Kit Tools
2. Debug Diagnostic Tool (DebugDiag)
3. WinDBG

Written by cavemansblog

April 16, 2008 at 2:19 pm