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.
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.
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.
Here are detailed instructions to increase a COM component's application pool limit in Windows Server 2008:
Go to Control Panel > Administrative Tools > Component Services.
In the tree, navigate through Component Services > My Computer > COM+ Applications and locate your custom component.
Right-click on the component and get Properties.
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.
Go try your web page once more, and voilà, it works again!