问题
When running a suite of tests in NUnit with WatiN through CruiseControl.NET (as a service), this error appears:
SetUp : System.Runtime.InteropServices.COMException :
Creating an instance of the COM component with CLSID
{0002DF01-0000-0000-000-000000000046} from the IClassFactory
failed due to the following error: 800704a6.
TearDown : System.NullReferenceException : Object reference
not set to an instance of an object.
This error has been a nightmare to debug because it is not consistent (happens 25% percent of the time) and is not reproducible. Has anyone has any similar issues?
回答1:
Reboot the machine
There are windows updates getting in the way of instantiating new COM objects.
After looking around on ServerFault and StackOverflow, I found several posts that mention the 800704a6
error code.
This one in particular made it click for me - https://serverfault.com/questions/179156/ie8-script-error-800704a6 stating that the error code was like to be ERROR_SHUTDOWN_IS_SCHEDULED
I had that exact error too:
Creating an instance of the COM component with CLSID
{0002DF01-0000-0000-000-000000000046} from the IClassFactory
failed due to the following error: 800704a6
回答2:
AFAIK WatiN needs a user (i.e. desktop) session to work. Thus my guess is:
- you are running CruiseControl.Net service as a normal user account
- this account is (usually) logged into the server hosting CruiseControl.Net
- the tests fail when there is no desktop session available
It used to be enough to check the box "Allow Service to Interact with Desktop" (Service Properties, tab "Log On"), but I'm not sure this still works after Vista. What will work (but in an ugly, hackish way) is running CruiseControl.Net from console, in a desktop session instead of as a service.
来源:https://stackoverflow.com/questions/6600482/watin-nunit-and-cruisecontrol-net-error-message-800704a6