Error message 800704a6 as part of creating an instance of the COM component

This will be a very short post, and comes from rage against Windows Server and the Windows update system. Because there were outstanding Windows Updates requiring a reboot, a particular build script of ours was falling over without suitable information as to why exactly.

The cryptic error was:

Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 800704a6.

The answer (at least for us):


There are windows updates getting in the way of instantiating new COM objects.

You’ll see a lot of people having a similar problem, not sure if reboot is the answer for them all, but make it your first step, and memorise the error code 800704a6. Unable to verify this but it looks to relate to the text code of ERROR_SHUTDOWN_IS_SCHEDULED.

The ServerFault post that helped most:

Stackoverflow Questions

Unit Testing JavaScript methods that contain jQuery ajax calls


Unit test a JavaScript method which contains a $.ajax() call. Using QUnit.


This was supposed to be a simple task, and if I didn’t have a few (now) obvious faults in my JavaScript code, it would have been completed more quickly. I have gone through several answering my own StackOverflow questions on the next day here’s the one in question for the curious ones.

I will hide behind the excuse of it being the early days of the new year and still finding my coding groove after almost two weeks on holiday…

So in this post I’ll summarise the two approaches I came out with in the end. It’s two because neither worked for me first time, and in my attempt to solve the first discovered the second. In the end resolving both. I won’t bother going into much detail about QUnit, as there are many posts out there about it; here, and here and here and official documentation here, and other interesting things to do with it.

As a quick aside we use the NuGet package NQUnit.NUnit to help us integrate QUnit into our Visual Studio projects.

Basic Approach

Solution 1 – basic way as is shown on this StackOverflow answer

// Arrange
    var options,
        jsonText = '{"id": "123", "fieldName": "fbs", "data": "fbs-text"}',

// Set up to 'capture' the ajax call (this forms the mock)
$.ajax = function (param) {
    options = param;

// Act - call the method which is 'under test'
/* ... */

// Call the success (or failure) method to complete the mock of handling of the 'response'

// Assert - verify state of system is as expected
/* ... */

Alternate Approach MockJax

Solution 2 – using the MockJax library with a great walk-through on how to use it here.

There are several advantages in using MockJax, that can be summarised as just having more control over mocking the ajax portion of the method under test, including but not limited to; timeouts, introducing latency, returning HTTP status codes.

After having included MockJax in your project, the solution 1 code gets replaced with 1 method call to $.mockjax() and looks like this.

// Arrange 
    var jsonText = '{"id": "123", "fieldName": "fbs", "data": "fbs-text"}';

// The call to mockjax replaces the need to overwrite the jQuery ajax() method
    url: '/Your/Regular/Action',
    dataType: 'json',
    contentType: 'application/json',
    responseText: jsonText

// Act - call the method which is 'under test'
/* ... */

//perform test assert state of system is as expected
/* ... */


Full QUnit test code is up as a Gist.

Find a working copy of the code here in it’s simplest form: