views:

141

answers:

2

VB 6.0 / ASP (not .NET) web application that runs in a windows server 2003 / IIS environment with sql 2005 server.There is a c/c++ component (exe/service) that runs on the server.

Customer would like to run in a windows clustered environment. Problems occur due to use of windows API GetComputerName. This pulls the actual server name, not the "alias" clustered name.

The c/c++ component was fixed by setting a property in windows for that exe which forces the getcomputername call to return the network name, which in this case is the alias cluster name.

The VB/ASP portion also has calls to getcomputername. Is there some setting, similar to how you can define a c/c++ exe, where you can force getcomputername to use the network name?

What we see is when the webpage login screen loads, where the version/feature info should be, there is an error stating: method ~ of object ~ not found. If we manually change the activecomputername reg key to be the alias clustername, this error goes away. Cant use this as a longterm fix because some windows process comes along and reverts this key value back to the correct name.

Does anyone have suggestions for ruuning vb apps in a clustered env? I'd prefer to not have to change the code, and would be semi-shocked if an app had to be written to be cluster-aware.

Thanks!

Update 7/31/2009

I was wondering if there was a way to tell IIS (or the vb assigned to the website) to use the network node name instead of the local machine name via the MS Cluster admin tool. I think that is where my disconnect is occuring with everyone's suggestions thus far. Again, I was able to add the c/c++ application in the cluster admin tool and configure that to use the network node name without modifying any code. Is there some way to do the same thing for the VB/ASP that runs in IIS. Does IIS have to be configured for clustering?

+1  A: 

Could you add this as a configuration element for the vb code and just pull in that?


Add a new file to your code named "ConfigCore.inc" with this content:

Dim isClustered
isClustered = false

This file should not be changed by your users, because you want to be sure the variables are at least defined and initialized. Then you add another new file to the app named "ConfigSetup.inc" that includes this ConfigCore.inc file. Here you will provide commented examples for how to set up desired behaviors:

''Uncomment the following line to enable this app to run in  a clustered environment
''isClustered = True

This file is documented as user-editable, and you include it elsewhere so that it's in scope where ever necessary.

Joel Coehoorn
dont think that is going to work.my basic question is does a vb web application have to be written to be cluster aware, or is there some setting in IIS / windows clustering that will allow vb apps to run in a clustered environment. I know you can do this with c/c++ executables and services.
MattLear
+1. @Matt: why won't this work.
AnthonyWJones
@Anthony @ Joel - I'm going to plead ignorance here in that I probably don't understand your suggestion. How would one create a config element for a vb container that runs in IIS?
MattLear
+1  A: 

See the details for GetComputerNameEx().

Note that according to that page on MSDN, if you pass in the NameType parameter as ComputerNameDnsDomain, the page states that "If the local computer is a node in a cluster, lpBuffer receives the DNS domain name of the cluster virtual server."

It looks like it should be fairly straightforward to create a VB wrapper for this.

Chris J
Thanks for the suggestion rangerchris. I'm trying to avoid changing the actual code in vb. Can you elaborate more on the vb wrapper?
MattLear
You need import the function like this:Private Declare Function myGetComputerNameEx Lib "kernel32" Alias "GetComputerNameExA" (ByVal enumNameType As Long, ByVal stringNameBuffer As String, ByRef bufferSize As Long) As BooleanstringNameBuffer and bufferSize use as GetComputerName(), the name-type can simply be an enum that mirrors the enum at http://msdn.microsoft.com/en-us/library/ms724224(VS.85).aspx .You will need to make note of the Remarks section on the GetcomputerNameEx page -- especially the para that says behavior "can be affected if the local computer is a node in a cluster"
Chris J