Does .NET have a BITS module?

2019-05-11 06:51发布

问题:

I have been researching in to using Background Intelligent Transfer Service. Most articles I have seen says there is no official .NET port but they recommend using sharpBITS. I will use sharpBITS if I have to but I noticed that all of the articles are referencing .NET 1.1 and 2.0, they seem to have been written before 3.0 came out. Was BITS added to 3.0, 3.5, or expected to be in 4.0? I have tried to Google around but BITS is too common of a word in the programming world.

回答1:

No, .NET 3.5 and .NET 4.0 do not expose a managed interface to the Background Intelligent Transfer Service (BITS).

BITS is a very Microsoft-specific technology, and it is highly unlikely they will integrate it into the base class libraries (BCL).

That being said, sharpBITS is probably your best bet, I wouldn't expect it to be in the BCL ever, but I could see it being a separate library that MS exposes under the Microsoft namespace (as they do with products like, Sharepoint and SQL Server Management).



回答2:

I don't think that there will be support for BITS directly in .NET. As .NET Core will be the future place for new features it is unlikely that a Windows only API for BITS will be part of the .NET Framework.

You can find a .NET wrapper for BITS including source code here: https://github.com/usis-software/usis.Net.Bits.

I've implemented this library because is seems taht sharpBITS is no longer maintained and also never made it to GibHub.

There's also a NuGet package available.



回答3:

No, there's no built-in class. There is a wrapper (Sample) that MS published:
http://www.microsoft.com/downloads/details.aspx?FamilyID=93540887-A6D1-405C-8B3C-45DB02E6A8D4&displaylang=en&displaylang=env



回答4:

Not exactly .NET but in newer versions of windows powershell commandlets (*-BitsTransfer) where added that allow you to manipulate BITS transfers.



回答5:

Good news! There's a brand new docs.microsoft.com page that talks about using BITS and C#, plus a brand-new C#/WPF sample on GitHub.

The sample shows how enumerate jobs, resume/pause/cancel, and make new jobs.