VssUnexpectedErrorException on VssBackupComponents.InitializeForBackup()

Nov 25, 2015 at 7:39 PM
Hi Peter,

Can I still post a question here? I don't see where to post on GitHub. If not here, where do you prefer?

Windows 7 Pro x64, Visual Studio 2015, .NET 4.0.

I'm running this code:
public void QuerySnapshot()
        IVssImplementation vss = VssUtils.LoadImplementation();
        using (IVssBackupComponents components = vss.CreateVssBackupComponents())
            components.InitializeForBackup(null); // Throws VssUnexpectedErrorException
    catch (Exception e)
        var s = e.ToString();
InitializeForBackup() throws this exception:

Alphaleonis.Win32.Vss.VssUnexpectedErrorException: An unexpected error occurred. The error code is logged in the error log file.
at Alphaleonis.Win32.Vss.ThrowException(Int32 errorCode) in d:\coding\alphavss\release\1.2\source\alphavss.platform\src\error.cpp:line 28
at Alphaleonis.Win32.Vss.VssBackupComponents.InitializeForBackup(String xml) in d:\coding\alphavss\release\1.2\source\alphavss.platform\src\vssbackupcomponents.cpp:line 469
at MyVSS.Vss.QuerySnapshot() in C:\MyVSS\MyVSS\Vss.cs:line 19

Where is the error log file to which the message refers?

Should the VSS service be running? I've tried running the samples with the service on and off; both are failing on VssBackupComponents.InitializeForBackup().

I've tried this code on a VM and my host machine but both fail on the same line. The sample exe shows the same error in the console window.

I'm clearly missing something, just not sure what!

Thanks tons for any direction!

Best regards,
Nov 26, 2015 at 1:46 PM
OK, I found vssadmin and also checked the Event Viewer :)

Event Viewer shows a few errors saying this:

Volume Shadow Copy Service error: A critical component required by the Volume Shadow Copy service is not registered. This might happened if an error occurred during Windows setup or during installation of a Shadow Copy provider. The error returned from CoCreateInstance on class with CLSID {e579ab5f-1cc4-44b4-bed9-de0991ff0623} and Name IVssCoordinatorEx2 is [0x80040154, Class not registered].

So I tried running a .bat to re-register the VSS components and saw these errors:
  • "swprv.dll" and "eventcls.dll" get loaded but DllRegisterServer fails with 0x80070715
  • "es.dll" was loaded but DllRegisterServer entry point was not found
  • "vssui.dll", "msxml.dll", and "msxml4.dll" failed to load (not found)
I'll work on these problems to see if I can get further down the road.