?

Log in

No account? Create an account

Previous Entry | Next Entry

Windows Scripting, IIS6 and ASP.NET 2.0

weather: mostly cloudy
outside: 1.8°C
mood: exhausted
My week has been a frazillion of these little things.


I fought with IIS6 today... I think I won. But I feel very wounded nonetheless.

We install our system with Windows shell scripts. I know we could have picked a real scripting language, but we were limited in choice to A) things that don't require installing anything extra and B) easily understood and modifiable by SysAdmin who, at Work, are all black belts in Windows shell scripting.

They're the ones actually using it, so that's what we're doing.

We need this because as the system scales out, there will be more and more different components to install.

An installation involves uninstalling and installing 5 services, backing up and upgrading 3 SQL Server 2003 databases, uninstalling and installing 4 web applications, one of which is a Web Service and one web app has three locales.

And, ... there ... will ... be ... more. One service and one web app is already waiting in the wings. And I'm quite positive there will be more services, more web apps, possibly more databases just because of the projected work coming up.

So, anyway, we need something to automate the installation.

We're also moving the entire suite from .NET 1.1 to .NET 2.0, so we're in that painful in-between time right now.

The web applications have to have their ASP.NET version set to 2.0 in IIS otherwise, nothing works. No big deal. %windir%\system32\aspnet_regiis.exe will do this for us.

My installation suddenly fails. That's REALLY not a good thing. I have an entire team of QA who are waiting for the morning build. I have to balance it between figuring out exactly what's wrong versus tweak it however I need to to get it going.

aspnet_regiis.exe takes "the path" of the application. Microsoft uses the backslash as the separator for paths. The VERY MOMENT I had gotten used to this, I'm hit with an "path not found" error and the thing barfed electrons all over my new pants.

    For example: Aspnet_regiis.exe -s W3SVC/1/ROOT/MyApp

FRAAAAAAAA!!! So, this is the ONE situation that Microsoft decides to use THE FORWARD SLASH for paths.

So, that's dandy. UNTIL. Until I have to try to hammer in the web site name passed into the script as an environment variable. That example only shows you how to register your app under the Default Web Site. QA does install to the Default and some environments install to Default, but not all. And SysAdmin names them different things; we won't really know what they can be or will be.

aspnet_regiis.exe takes, as a parameter, "the path". But this is the Metabase path where one of components is the ugly-ass nine-digit Instance ID of the web site name. It's not displayed anywhere in inetmgr... at least, I couldn't find it. I only knew because I ran iisweb /query and it listed all the local IIS web sites with their Instance IDs. Microsoft couldn't be sane or anything and let you just use the web site name. No, that would be no fun. *eye roll*

ASP.NET Support had released ASPNETMapping_norestart.vbs to scry the Instance ID from the name and do it all for you.

That's wonderful. EXCEPT. Except it hooped itself up badly enough that it took me a while to unhoop it. It works fine, but it can't exit. When it hangs like that, it keeps a handle on the folder. Which meant I couldn't delete the folder.

It took me a while to find that both wscript and cscript were still holding on to it. As soon as I killed the the wscript process, it was fine. If I killed the cscript first, nothing happens. I changed the default script host to CScript and it worked like a charm. Even though we're always running it as %windir%\system32\cscript ASPNETMapping_norestart.vbs ..., ASPNETMapping_norestart.vbs makes a call to aspnet_regiis.exe, which then uses the default script host. And in WScript mode, I'm betting it popped up a confirmation and was waiting for me to press "OK". Only I'd never see it because I'm running a remote script. Even if I logged in with Remote Desktop, the popup is not in my session so it wouldn't have appeared.

Now I'm torn.

I could just making the ASP.NET version set to 2.0 as a prerequisite for installation. This makes it SysAdmin's responsibility to do it. They're okay with that as long as we tell them ahead of time and document it... which I think I do a decent job at.

But, I feel like I'm so close to getting this done. I'd just have to set it in the script — %windir%\system32\cscript //H:CScript //Nologo //B. The danger in doing this though, is that it's a global setting for the machine and I don't want to blast it, in case they had other scripts that needed to be run with WScript.

I could even set it to CScript, then set it back to WScript afterwards. But there's no way to see what it was before changing it, so I can't be guaranteed that I would be putting it back to what they had. Ah well. I e-mailed the SysAdmin crew explaining it and leaving the decision up to them. I haven't heard back. I'm guessing I'll talk to someone about it on Monday.

Oh wait, I think I just found a way to do this. I'll have to try that on Monday.

Hmm... I don't think that will work either. Scrying for WScript needs human intervention =\

Oh, duh. I wonder if I could just explicitly make the aspnet_regiis.exe call a CScript call in the ASPNETMapping_norestart.vbs... Yeah, I'll try that on Monday.

Tags:


Comments

( 2 comments — Leave a comment )
canadianabroad
Feb. 3rd, 2007 09:42 pm (UTC)
Good Lord.
Good lord, what a headache. And here I'd thought that, with the mantle of Technical Writer, you could shirk of such technical responsibilities as the ones described. Did you opt for the multi class option then - QA / Tech Writer?

Me, I've jumped ship fully to the writing side. I get a techy project I'm interested in, great!. I get tossed something I don't enjoy, and suddenly "I'm an *author*. I couldn't possibly deal with this type of fiddly business." (This works especially well with those who don't know my tech background.)

So well done in cracking the case. Is it wrong that I pictured you hunched over a glowing screen in some time of M4D H4X0R getup, tech music pounding away in the background, as you try to solve the tech crises of the Mother Corp.?
bride
Feb. 3rd, 2007 09:55 pm (UTC)
Re: Good Lord.
Hunched over a glowing screen, +1/+2 Nerdy Glasses and all =)

No, I haven't fully jumped ship to the Writer side. I'm still all over the place. Full-on QA with deployment and writing capabilities. If nothing else, it's resume stuffing. =)

I think I naturally gravitate towards the Miscellaneous Fiddly Business and the "if it doesn't drive me batshit, I quit" type of work =D
( 2 comments — Leave a comment )

Profile

eLouai
bride
The Bride of the First House

Latest Month

March 2015
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031