This project is read-only.

Occasional RPC error from EnumJobs

Jul 30, 2015 at 5:36 PM
We have a windows service that uses SharpBits and it will occasionally fail with an RPC error. The error message and stack are below.

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

at SharpBits.Base.IBackgroundCopyManager.EnumJobs(UInt32 dwFlags, IEnumBackgroundCopyJobs& ppenum)
at SharpBits.Base.BitsManager.EnumJobs(JobOwner jobOwner)

The only way to resolve this is to stop our service, restart the BITS service, and then start our service.

Has anyone else experienced this issue?

Aug 17, 2015 at 6:44 PM
sounds like an issue in the underlying BITS components or COM interface, hard to track if this is something related to SharpBITS code. In particular, if restarting the service does solve the issue, the only SharpBITS may do is to restart the service automatically. Not sure though if thats some functionality to add.
Jan 4, 2017 at 1:28 PM
We're experiencing a similar issue with our Windows service:

System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
at SharpBits.Base.IEnumBackgroundCopyJobs.Next(UInt32 celt, IBackgroundCopyJob& rgelt, UInt32& pceltFetched)
at SharpBits.Base.BitsJobs.Update()
at SharpBits.Base.BitsJobs.Update(IEnumBackgroundCopyJobs jobList)
at SharpBits.Base.BitsManager.EnumJobs(JobOwner jobOwner)

xidar, were you able to find the root cause of the issue?

Jan 7, 2017 at 3:20 PM
never came to the bottom of this issue, as there could be a couple different reasons - most often tied to limited permissions or corrupted (D)COM settings.
The only other lead is this thread on Stackoverflow:

Even that doesn't track down why the COM instance may get corrupted at first place, but gives some idea how to solve - basically just reinitializing the COM handle if an exception occurs.

Simple test could be to restart SharpBITS and see if this solves the issue. Else if the issue still occurs, it's most likely one of the reasons mentioned above (permissions/DCOM settings).