I was recently faced with the problem of writing an application responsible for uploading files consisting of several Gigabytes over the internet and we decided to integrate with Microsoft’s BITS technology (Background Intelligent Transfer Service). That’s because there’s a 2GB limit in terms of what you can send over http, so you need some technology to slice up a file in smaller bits and transmit each of these bits and then re-assemble them server side. For this sort of thing, BITS is perfect. Coincidentally it’s the same technology that Microsoft uses to push updates to your machine. There is a .NET wrapper that you can use https://sharpbits.codeplex.com/ which makes integration with BITS a lot simpler.
One frustration in dealing with BITS as a developer though – is that while you’re debugging your application, you often end up with BITS Jobs in a “corrupt” state – they’re neither active nor paused nor cancelled. Getting rid of these corrupt jobs can be an irritation as not even rebooting your machine will get rid of them!
There are three things you can try.
1. Clear out via command prompt
The easiest thing is to run your standard command prompt as an administrator and run this command:
bitsadmin /reset /allusers
That should do it. If that doesn’t work, however,
2. Clear out via Powershell
try firing the next commands from Powershell:
Get-bitstransfer –allusers | remove-bitstransfer
Most of the time, either one of the two options should do the trick. But at times, a corrupt job will be stubborn and you need to take stronger measures to remove the sucker. In which case I recommend the following:
3. Hard Delete
Microsoft stores BITS jobs here:
1. Stop BITS service from your windows services in control panel
2. Delete all the .DAT files from the location above.
3. Start your BITS service again.