|
|
You need to create to create a .Net assembly from the BITS .idl file. To
create the assembly, you use the tlbimp.exe tool. This works fine if you
don't need to use the SetCredentials method, which you do. The problem is
that MIDL does not convert the credentials structure because it includes a
union and unions are not part of C# or VB.Net. The work-around is to write a
managed C++ wrapper that calls the SetCredentials method.
If you haven't downloaded the PSDK, you need to do that so you have the BITS
.idl files. You can download the PSDK from
(http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ (BITS is
included in the CORE SDK).
These are the steps to create the BITS 2.0 assembly:
1) Set up the environment to run the MIDL compiler.
Start, Microsoft Visual Studio .Net 7.0, Visual Studio.Net Tools, Visual
Studio.Net Command Prompt
2) Change to a directory in which you want to create the assembly.
3) Copy the bits2_0.idl, bits1_5.idl, and bits.idl files to the directory.
4) run "midl bits2_0.idl" to create the .tlb file (type library)
5) run "tlbimp bits2_0.tlb" to create the BackgroundCopyManager2_0 assembly
file.
Reference the assembly in your project and add the BackgroundCopyManager
namespace to your file.
If you need a managed C++ wrapper example that calls the SetCredentials
method, email me and I'll attach the source files.
--
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
www.microsoft.com/info/cpyright.htm">http://www.microsoft.com/info/cpyright.htm
<TDeveloperDotNET@xxxxxxxxxxx> wrote in message
news:1110472899.089474.89770@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I have an application (VB .NET) that uses BITS to download files from
> web server (IIS) site into a local client machine. This IIS uses
> Windows Authentication. I've done some research and saw that BITS has a
> IBackgroundCopyJob2::SetCredentials method that can set a user
> credentials so that BITS can access the download site.
>
> However, the example on msdn shows a C++ implementation. I read another
> article and was told that BITS was/is intended for C++ developers, and
> that if we want to implement SetCredentials in a .NET language we need
> to have wrapper classes and stuff. I am fairly new to the development
> world, so COM or any topics pre-.NET, including C++, is almost Greek to
> me. I'd really appreciate any help on pointing me in the right
> direction regarding this isue of mine.
>
> Thanks!
> TDeveloper
>
|
|