一、准备工作

1、新建一个空白解决方案“Kinoo.WCF.AyncFileTransfer”,添加一个WCF服务库项目“Kinoo.WCF.AyncFileTransferService”,添加一个WPFWindows程序“Kinoo.WCF.TestClient”,为简化工作,不添加主机了。

2、将“Kinoo.WCF.AyncFileTransferService”项目中的默认服务Service1改名为“FileTransfer”

3、在项目“Kinoo.WCF.TestClient”中添加服务引用,在【添加服务引用】窗口中直接点击【发现】,将命名空间命名为“AsyncFileTransferServiceReference”。

做完上述工作后,解决方案如下所示:

.NET 4.5 WCF 异步文件上传/下载-1-不带进度条

4、在WPF项目的MainWindow中添加几个控件:

  • <Window x:Class="Kinoo.WCF.TestClient.MainWindow"
  •         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  •         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  •         Title="MainWindow" Height="350" Width="525">
  •     <Grid>
  •         <Button Name="btnBrowse" Content="Browse" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top" Width="75" Click="btnBrowse_Click"/>
  •         <ListBox Margin="30,60,30,30" />
  •         <Button Name="btnUpload" Content="Upload" HorizontalAlignment="Right" Margin="0,30,30,0" VerticalAlignment="Top" Width="75" Click="btnUpload_Click"/>
  •  
  •     </Grid>
  • </Window>
  • 相关文章:

    • 2022-12-23
    • 2021-07-06
    • 2021-11-22
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-03-08
    • 2022-02-02
    猜你喜欢
    • 2022-12-23
    • 2021-11-22
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    相关资源
    相似解决方案