The Bride of the First House (bride) wrote,
The Bride of the First House

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: nerdy, work-2

  • Zzz... Huh? Wha?

    weather : partly cloudy outside : 15°C mood : ... My head tips off one side of my palm where it was resting,…

  • Paladin Girl

    weather : muggy/raining outside : 26.5°C mood : I'm trying to pick a name for a new famale Paladin. I'm not sure if…

  • Buy Happiness with Money

    weather : partially cloudy outside : 8.7°C mood : I've said this to a few people and it seemed to make a significant…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded