Sunday, April 17, 2011

.WSC won't recognize code changes

I've run into this problem before and the solution has usually been to restart IIS. Basically I've made a number of changes to a .wsc file on our server. But when it runs it doesn't run the new code changes I made. I've verified this with event logging at the beginning of the file and it doesn't show up.

My problem is that obviously restarting IIS on our production server is something I'm loathe to do, but we need this running today. I've tried re-registering the file but to no avail.

The server is a 32-bit Server 2008 OS. And the code is running, it still generates the file it is supposed to, but like I said, it's not using the latest changes.

Any other info I can provide, please leave a comment and I'll edit.

Thank you, Jeff

Edit: Oisin, thanks for the reply and yes I know I hate VBScript, and anything related to it including these Window Script Components. I've expressed such feelings to my manager, but it's a dirty job and someone has to do it!

Yes it's using a Server.CreateObject to call the component.

ANSWER: I've since realized my mistake. I was only 'registering' it over and over, when I should have first 'unregester'ed it the 'register'ed it. Man I feel stupid, but haste makes waste as they say.

Thanks for the response and link!

From stackoverflow
  • Eek, you mean WSC as in a Windows Script Component? I haven't written one of them since 2000.

    Are you loading it using CreateObject (e.g. it's registered as a COM object via regsvr32), or are you using a file-based moniker to load it? (not registered).

    If it's registered, it probably is cached until app restart. If you switched to a file based moniker, e.g. like: Set o = GetObject("script:c:\path\obj.wsc"), you might get away with runtime changes to the .wsc file.

    (man, how did I even remember this)

    more info here - quick before it's archived! :D http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/default.mspx

    -Oisin

    Jeff Keslinke : I'll give you the answer since you're the only one who wrote back :)
    x0n : heh, probably cos i'm the only one old enough to know this stuff. :)
    Cheeso : WSC is still viable and still works well. With all the code being written in JavaScript, Python, and other scripting languages, WSC is even more useful now. Today I hosted Google's Diff/Match/Patch library, written in Javascript, in a WSC. No porting, no code change. It's now usable from any COM client. Easy.

0 comments:

Post a Comment