Tag Archive for: windows-2003

Less Than Helpful

26 Mar 2011
March 26, 2011

Here’s an awesome Event Log error I found on a client’s server yesterday:

Intriguing Event Log error

An application pop up happened. From an application. Problem is, it doesn’t tell me what the popup said — or what application popped it!

I was amused.



Windows 2003 Real-Time Mirroring?

24 Sep 2010
September 24, 2010

Help me, Lazyweb!  I’m looking for ideas on setting up some sort of real-time mirroring or sync between folders on a couple Windows servers. Years ago I used FolderShare for this, but that’s gone; folded into Windows Live Sync and I suspect my folders are too big for it (but am willing to be corrected! Details below).

Here’s a copy of what I put up on ServerFault.com but hasn’t received any input (yet)

[Updated] Deleted that original ServerFault.com post. Had too much info and no reads. Here’s a link to the newer less-info more-active version.

While rebuilding our Dev environment I decided to build the Dev web server on Windows 2003 Web edition to be the same as what is in production. Alas, one small snag: Our production team spend a lot of time working with PDFs on the dev web server via File Shares and Windows 2003 Web edition has a 10 session limit.


So, I need to do something different to stop the session limit issues. I’m thinking that I’ll copy the PDF libraries to our File Server (win2k3 Standard R2) and implement some sort of real time mirroring between the File server and Web server for those directories.

We’re talking about 1 “main” directory, 500 sub-directories (at various levels) and just under 10K documents.

What would you suggest for the mirroring?

Stuff I’ve looked at

I looked at the “new” DFS Replication that was introduced with Windows 2003 R2 but that’s not an option with the non-R2 Windows 2003 Web edition. The “old” DFS is there (remember Roots and Links?) but I had some rough experiences with it and reliability in the olden days of Windows 2000. Perhaps it is better with 2003?

Windows Live Sync might be interesting, but I think I exceed the limitations, depending on how you translate this particular note (source):

You can synchronize up to 20 folders containing up to 20,000 files each. Files can’t be larger than 4 gigabytes (GB).

Think that includes subfolders?

As you can tell by what I’ve looked at so far, free or cheap would be really awesome.

Worse case, I could run robocopy /mir as a scheduled job every 1 minute but that’s a little abusive!

Better ideas?

Oh, Did You Want a Timeout?

24 Aug 2010
August 24, 2010

Back in February I mentioned that I was reconfiguring my IIS 6 web servers to shutdown the App Pools after 2 hours of inactivity. That seemed a much better option than the brute force iisreset that I’d been scheduling as a nightly event.

Turns out I wasn’t quite done yet. Here’s a snip of a conversation I had earlier today with my CTO, Hans.

“Ya know, I wish I had some better tools to see how many active users we have across all the sites at a given moment,” I said. “That would be helpful when I want to sneak in a quick change during the day.”

“Well what do you currently do to check?” he asked.

“I just pop open the latest IIS log file, jump to the bottom and see if the most recent entries are from my once-a-minute WhatsUp Gold site monitoring. If the last few entries are from WhatsUp then I know we’ve been idle that many minutes.”

He nodded and we moved onto another issue which resolved around some memory related issues.

I commented, “It seems like this main w3p process never shrinks. It just keeps growing its memory usage. How weird. Come to think of it, I’ve never seen a Windows Event about it shutting down or spinning back up…”

Hans just gave me the look and said, “Didn’t you mention your monitoring process hits that site every minute?”


“oh yeah… I guess it’ll never hit that 2 hour timeout, huh?” Don’t laugh… If you poll the site every minute don’t expect it to ever go idle!

Today I spent some time fixing that. I’m not sure what the best practices are but I have an approach that seems reasonable.

First, I created a new site with just one page (ping.html). Next, I created a new App Pool called monitoring just like the Default. But instead of a timeout I configured it to restart itself at 1:00 AM nightly. Then I converted that new site to an IIS application using that new App Pool.

IIS App Pool settings

My maint site's IIS app settings

I changed the WhatsUp monitor to use a custom HTTP Content monitor pointed at the new site. Now it tests for content from the ping.html page instead of just seeing if something responds on port 80 so this is probably even a bit better than it was before.

This brought up another small issue though.

Wait! How do I know which w3p process ties to which App Pool?

Now I have more App Pools all running as the same user. How can I quickly tell which process goes to which pool? Easy!

This picture lays it out:

App Pools and w3p processes

On the IIS server bring up a command prompt, navigate to the system32 directory and run:

cscript iisapp.vbs

The output lists the process ID (PID) and name for each w3p.exe process. Problem solved.

Windows 2003 TCP Tweak

08 Nov 2009
November 8, 2009

I have spent the past few days working on migrating a bunch of classic ASP web applications from a Windows 2000 server to a Windows 2003 server. A long overdue task, but one who’s time has finally come. The hardware under the Windows 2000 box has been acting up a bit lately and I’m rapidly losing confidence in it. Not to mention that Windows 2000 is getting closer to the end of support.

The good news is that most of the migrated sites worked right off the bat. The key word being “most.” In one of the apps we have some code that’s a bit out of the norm – deeply recursive with lots of SQL Server database IO. Every time we’d hit that code we would get an error after over a minute. And every error was on a different line of code:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

Now, we know the database server didn’t suddenly go away because it had to exist to even get to this point.

After confirming that this stuff still works on the old Win2K server (against the same database server) we started poking around the code. No recent changes there and after way too many hours we took a break last night to mull it over some more.

This morning I decided that it might be interesting to install the SQL Server native drivers instead of using the ones that are bundled with Win2K3 (remember ODBC?). I installed the drivers, rebuilt the ODBC DSNs and tried again.

Still get an error, but now it is a little different:

[Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [1326].

Funny, but that error was caused by the new drivers. I had to change the connection string to force TCP/IP instead of named pipes (the DB server is on a different subnet behind a firewall).

OK, back on TCP/IP connections we get yet another new error:

[Microsoft][SQL Server Native Client 10.0]TCP Provider: Only one usage of each socket address (protocol/network address/port) is normally permitted.

Oh, but wait – we have a new little twist. On a whim, my testing partner hit refresh on that error page and it reloaded and completed without error.

Clearly we have an environmental issue, not a coding issue (we can debate if deeply recursive ASP is an issue another day!)

After a bit of searching I turned up an interesting blog post titled, “Only one usage of each socket address (protocol/network address/port) is normally permitted.” It starts with a nice summary of why I’m getting these errors:

Here is the scoop
1. When you make authenticated calls, the client is closing connections. And when you are making authenticated calls repeatedly to the same server, you are making and closing connections repeatedly
2. The same might happen when you are making regular http [un authenticated] calls but setting keep-alive = false.

When a connection is closed, on the side that is closing the connection the 5 tuple { Protocol, Local IP, Local Port, Remote IP, Remote Port} goes into a TIME_WAIT state for 240 seconds by default.
In this case, the protocol is fixed – TCP. [T]he local IP, remote IP and remote PORT are also typically fixed. So the variable is the local port. What happens is that when you don’t bind a port in the range 1024-5000 is used. So roughly you have 4000 ports. If you use all of them in 4 minutes – meaning roughly you make 16 web service calls per second for 4 minutes you will exhaust all the ports. That is the cause of this exception.

The article continues with a solution based on a couple registry modifications:

1. One of the ways is to increase the dynamic port range. The max by default is 5000. You can set this up to 65534.
HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort is the key to use.

2. The second thing you can do is once the connection does get into an TIME_WAIT state you can reduce the time it is in that state, Default is 4 monutes, but you can set this to 30 seconds
HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\TCPTimedWaitDelay is the key to use.
Set this to 30 seconds

Neither of those keys existed for me so I created both (as DWORD type). I used 32768 for the first one and 30 for the second. Rebooted the box and stuff started working!

As we add load to this machine I’ll likely have to revisit both parameters – and probably the code itself to try and streamline things a bit. I’m pretty sure I’m going to knock that 30 seconds parm down to closer to 10. But for now I’m happy. I have a server ready to take on the load and everything works.