IIS Stopping because of COM

Sometime ago we wrote a COM object to use on IIS.  Nothing fancy, we just use it to control the layout of our navigation on our web site (btw we used COM because of the inherent problems in IIS 4 of memory hogging when using asp include files).  The COM works fine under NT Server.

We've now moved to Windows 2000 and IIS5.  We're experiencing problems where IIS just stops (and needs to be reset).  This seems to be random.  We are wondering if it could be something to do with the COM.

Are there project/build settings or other considerations that we need to think about and change that could be causing this issue.

It's on our production servers so it's pretty urgent.

We're not experts in VB or COM but are ok, but the more details the better.

Who is Participating?
mdouganConnect With a Mentor Commented:
Well, that could be.  The first question I'd have for you is how are you creating an instance of your COM+ object?  If you are using New as in Dim x as New MyObject, then even if you have this object loaded into a COM+ application, you'll be using COM and not COM+ to load it.  You'll need to ensure that you are using CreateObject instead.  There is another thread where I've gone into detail about various pieces of syntax in switching a COM object to a COM+ object, and rather than pasting all of that text here, I'll just give you the link:


There is also a link on one of the comments there about a document called complus from microsoft.  You should download this document and read through it.  I followed the recommendations closely and had great success.
martinbwAuthor Commented:
btw we do if possible want to keep using the COM.  We understand that IIS5 is better in terms of resource allocation with include files, but the COM contains a fair bit of functionality and we don't have the time right now to convert the site.
Well, since you are not on windows 2000, I'd recommend that you turn your COM object into a COM+ object.  It will then run out of the process of the web server, so, even if your COM object crashes, it won't take down the webserver.  I think that you had an option with MTS to run a COM out of process, but that might have only been for Active-X EXEs....  no such limitation under COM+
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

read that as "since you are NOW on windows 2000"
martinbwAuthor Commented:
Thanks.  How do we build/turn the COM object into a COM+

mdougan is correct.  Make your object a COM+ app, and you will find it much more stable anyway.  You don't have to rebuild the object, just set up a com+ app that points to it.  

To do so, you need to use "Componenet Services" of Windows 2000.  You can find this on Start->Settings->Control Panel->Component Services.  

Here are the steps you need to take:

1) Unregister your component:  At the command prompt, type
     regsvr32 /u c:\the_path_here\file_name.dll

   Also a good idea is to run iisreset at this point.

2) Open Component Services, and navigate to:
     /Component Services/Computers/My Computer/COM+ Applications

3) Right click on COM+ Applications, and select "New Application" to open the wizard.

4) Click "Create an empty application", Select the type of process activation you want, give the application a user to run as.  (Note that if you specify a user, and have a password change policy, when the password is changed this will fail to authenticate.)

5) Navigate to the empty COM+ application, then down to its Components.  Right Click on "Components" and select "New Component" to start yet another wizard.

6) Select your components in the wizard.  This will register the COM object with the system.  Complete the wizard.

7) Go back to the COM+ application level, right click on your application, and select "Start".

That should do it for you.

Test this on your staging machine before you do it on production.

Good luck,
Well, that might be true.  It depends on what your component does.  You have to make sure that it is set up to run under MTS Transactions.  Either UsesTransactions or RequiresTransactions if you're updating a database.  Your methods should either call GetObjectContext.SetComplete or GetObjectContext.SetAbort (one of them must be called if you've specified uses or requires transactions).

You'll want to make sure that you instantiate the object using CreateObject and not Dim x as New MyObject.  And, if you create any other COM objects inside of this COM object, then you'll need to use:

Dim oClients as MyClass.MyClient

Set oClients = GetObjectContext.CreateInstance("MyClass.MyClient")

So that any transactions that occur in oClients gets wrapped in the transaction for the original COM+ object that you're calling.

Microsoft has some good white papers on Programming Guidelines for Visual Basic COM+ Applications
Has your original question been answered?
martinbwAuthor Commented:
No, not really.  We've installed the COM as a COM+ but the servers still going down. Now, it could be something else or it could be the COM (when we ran the site in a non-com version it worked OK) as soon as we put the com on it became unstable and unpredictable.

The COM was designed and developed under NT.  We don't have that much expertise in VB here, hence the question.  What should the build configurations really be for the dll?  Maybe we've been doing something wrong right from the start...
Hi martinbw,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mdougan's comment(s) as an answer.

martinbw, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
martinbwAuthor Commented:
We resolved this by removing a call to another COM object within our own COM object.  This was causing the problem.  So none of the answers really resolved it for us.  Can we close it and give 50 points to mdougan (for the effort and suggestions) and refund 50 to my account.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.