1

I want to upload files to IIS server using BITS extension. I have a powershell script that uploads successfully:

Import-CSV filelist.txt | Start-BitsTransfer -TransferType Upload

Where 'filelist.txt' is CSV file containing following content:

Source, Destination iis-85.png, http://172.18.3.131/Uploads/iis-85.png

To upload via C# I am using following snippet:

private Manager manager =  new Manager();
private Job UploadJob = new Job("Download Job");
DownloadJob.Files.Add("http://172.18.3.134/uploads/iis-85.png","C:\Users\mohsin\Downloads\BITS\BITS\iis-85.png");
manager.Jobs.Add(DownloadJob);
DownloadJob.Resume();

But the job status always shows as queued.

jps
  • 20,041
  • 15
  • 75
  • 79
Mohsin Abbas
  • 73
  • 1
  • 12
  • So this is about a microsoft specific file transfer protocol. Despite using IIS, it has nothing to do with html. If you hover the mouse over the labels below your question, you will see 500K users interested in C#, but only 7 in BITS. Good Luck! – Roland Dec 14 '18 at 09:18

1 Answers1

0

I'm delighted to say that there's some brand-new documentation on how to call into BITS from .NET that may help. That documentation describes how to use BITS using Reference DLLs.

Which .NET library are you using in your code? Can you point me to its documentation?

My first thought from looking at the code snippet you provided is that you're mixing upload and download jobs. For example, you make a variable called UploadJob with a name of "Download job" but then when you add files, it's to a variable called DownloadJob. Can you provide a larger code sample?

PESMITH_MSFT
  • 350
  • 1
  • 9
  • I'm also very happy to say that there's now a .NET and BITS sample on GitHub! Take a look at the new [BITS Manager](https://github.com/Microsoft/BITS-Manager) utility -- there's both source code and an installer! – PESMITH_MSFT Jan 08 '19 at 23:38