Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Server.CreateObject Failed" on COM+ component creation from classic ASP on IIS 7

I have a classic ASP application running on IIS 7 in Windows Server 2008 R2 Standard.

It was working fine at one point in the day when suddenly, without any code changes, it began throwing the following error while instantiating a COM+ component:

MyObject = Server.CreateObject("MyCustomComponent.MyCustomObject")

Server object error 'ASP 0177 : 80004005'

Server.CreateObject Failed

/path/script.asp, line xx

80004005

What could be the problem? I did an internet search and found dozens of potential answers, none of which seem to have anything to do with the problem. I know I'm using the correct object name--it was working just a little while ago. Nothing has changed! I've spent almost 2 hours trying to figure this out and have come up empty.

like image 502
ErikE Avatar asked Mar 19 '13 17:03

ErikE


1 Answers

General Troubleshooting of Error 80004005

This error can be difficult to troubleshoot given the huge variety of potential causes for it. A quick internet search reveals a horde of suggestions.

The key aspect here for narrowing down the possible problem to a reasonable list is that the code was working and suddenly began failing, without any code changes. Assuming no major IIS or COM configuration changes, this rules out the possibility of, for example, having used the wrong class name for the component, or the component not being registered properly. Instead, one has to turn attention to some configuration of IIS and COM themselves that could allow inconsistent behavior without a settings change having occurred.

  • Review any user account permission changes to the user accessing the site, the user set up for IIS to run under, or the user account the COM component is set to impersonate.
  • Review the application pools set for the site or application in IIS.
  • Review any permission/authentication/impersonation code in your ASP code.
  • Review the settings of the COM component itself.

The Actual Problem

Ultimately, the problem boiled down to the fact that multiple IIS sites and applications, each in separate IIS application pools, were using the same COM component. This is not a problem per se, except the COM component was set to allow a maximum of 1 application pool accessing it at once.

The reason that the page worked for a while was that it managed to be first to grab the COM component. The other site/page/application pool that uses the same COM component would have failed had anyone accessed it. Since the COM component was set to be released after 3 minutes, this gave the opportunity for the other page, when visited, to "grab on" to it and prevent it from being used in the new page being tested.

The Fix

Here are detailed instructions to increase a COM component's application pool limit in Windows Server 2008:

  1. Go to Control Panel > Administrative Tools > Component Services.

  2. In the tree, navigate through Component Services > My Computer > COM+ Applications and locate your custom component.

  3. Right-click on the component and get Properties.

  4. On the Pooling & Recyling property page tab, set the Pool Size to a number greater than 1, to match the number of potential application pools that will be accessing the component at the same time, from IIS or elsewhere.

    COM+ Pooling & Recycling

  5. Go try your web page once more, and voilà, it works again!

like image 95
ErikE Avatar answered Nov 03 '22 21:11

ErikE