Requester for exchange

Jun 17, 2014 at 10:59 PM
I've written a vary simple requester which runs as an on-demand service. While this seem kind of useless, It's being called by my storage system which can take a snap-shot instantaneously, but it needs to make sure everything is consistent while it does.

OnStart
IVssBackup.InitializeForBackup (null);
IVssBackup.SetBackupState (false, false, VssBackupType.Full, false);
IVssBackup.GatherWriterMetadata ();
IVssBackup.SetContext (VssSnapshotContext.AppRollback);

SnapshotSet = IVssBackup.StartSnapshotSet ();
foreach (DriveInfo i in DriveInfo.GetDrives()) {
    if (i.DriveType == DriveType.Fixed) {
        IVssBackup.AddToSnapshotSet (i.Name);
    }
}

IVssBackup.PrepareForBackup();
IVssBackup.DoSnapshotSet();
IVssBackup.GatherWriterStatus();
OnStop
IVssBackup.BackupComplete ();
IVssBackup.DeleteSnapshotSet (SnapshotSet, false);
IVssBackup.FreeWriterMetadata ();
IVssBackup.FreeWriterStatus ();
IVssBackup = null;
my problem is the exchange vss writer doesn't like this, and fails. Am I doing something wrong? Does exchange require some extra effort?
Jul 2, 2014 at 8:51 AM
You should debug and check where your app crash! After you know what instruction cause the problem check the system event registry for more information.

Check this link for the required steps to perform VSS backup: http://msdn.microsoft.com/en-us/library/aa384589(v=vs.85).aspx
(i'm refering to the 5 "Overview of xxx" articles)

Now some question (don't answer me to those, just use them to localize your problem)

Have you did the LoadImplementation()?
Have you did the CreateVssBackupComponents()?
Have you tried to use the EnableWriterClasses() to force Exchange VSS Writer enable? (every vss writer has a fixed guid, you can find it in msdn)
Did you check if Exchange writer exists after Gathering writers metadata? Hint: you can do that with this:
foreach (IVssExamineWriterMetadata singleWriter in oVSS.WriterMetadata)
Did you check if your operation needs to call the AddComponent()? (you can get component list from the singleWriter element in the example)
Are you sure Exchange VSS Writer supports AppRollback context?

Using VSS requires some time to do test and understand why stuff go wrong, the event registry and msnd are your only friends, use them! :)