另外使用wcf时,最好不要使用using因为使用using会屏蔽掉很多错误,误导用户,参考链接:http://www.codeproject.com/Tips/197531/Do-not-use-using-for-WCF-Clients相关代码改为:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Windows.Forms;usingSystem.ServiceModel;namespaceWcfUploadServiceHost{staticclassProgram{//////Themainentrypointfortheapplication.///[STAThread]staticvoidMain(){try{varhost=newServiceHost(typeof(WcfUploadServiceLib.UpLoadService));host.Open();Console.WriteLine("Serverisopened...");Console.Read();//using(varhost=newServiceHost(typeof(WcfUploadServiceLib.UpLoadService)))//{//host.Open();//Console.WriteLine("Serverisopened...");//Console.Read();//}}catch(Exceptionex){Console.WriteLine(ex.ToString());Console.Read();}}}}-IMDN开发者社群-imdn.cn"> 另外使用wcf时,最好不要使用using因为使用using会屏蔽掉很多错误,误导用户,参考链接:http://www.codeproject.com/Tips/197531/Do-not-use-using-for-WCF-Clients相关代码改为:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Windows.Forms;usingSystem.ServiceModel;namespaceWcfUploadServiceHost{staticclassProgram{//////Themainentrypointfortheapplication.///[STAThread]staticvoidMain(){try{varhost=newServiceHost(typeof(WcfUploadServiceLib.UpLoadService));host.Open();Console.WriteLine("Serverisopened...");Console.Read();//using(varhost=newServiceHost(typeof(WcfUploadServiceLib.UpLoadService)))//{//host.Open();//Console.WriteLine("Serverisopened...");//Console.Read();//}}catch(Exceptionex){Console.WriteLine(ex.ToString());Console.Read();}}}} - IMDN开发者社群-imdn.cn">
登录
首页 » C# » wcf 实现大文件上传(有进度条)实例源码

wcf 实现大文件上传(有进度条)实例源码

于 2015-01-07 发布
0 141
下载积分: 1 下载次数: 0

代码说明:

部分win7/win8用户 运行时报错 可能是 权限问题,所以运行项目的时候 要右键>>以管理员身份运行 部分用户 运行该项目的时候 可能提示:协定需要双工 但是绑定 NetTcpBinding 不支持 这是只需要将host项目app.config中协议部分 改为wsDualHttpBinding 即可,如下代码: 另外使用wcf时,最好不要使用 using 因为使用using会屏蔽掉很多错误,误导用户,参考链接:http://www.codeproject.com/Tips/197531/Do-not-use-using-for-WCF-Clients 相关代码改为:using System;using System.Collections.Generic;using System.Linq;using System.Windows.Forms;using System.ServiceModel;namespace WcfUploadServiceHost{ static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { try { var host = new ServiceHost(typeof (WcfUploadServiceLib.UpLoadService)); host.Open(); Console.WriteLine("Server is opened..."); Console.Read(); //using (var host = new ServiceHost(typeof(WcfUploadServiceLib.UpLoadService))) //{ // host.Open(); // Console.WriteLine("Server is opened..."); // Console.Read(); //} } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.Read(); } } }}

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • HFPVU
    Programming library function query dictionary
    2018-12-26 07:24:23下载
    积分:1
  • C#应用第2版源码
    【实例简介】C#网络应用编程第2版源码
    2021-11-25 00:44:46下载
    积分:1
  • TCP服务器框架(HP-Socket)
    HP-Socket 是一套通用的高性能 TCP/UDP 通信框架,包含服务端组件、客 户端组件和 Agent 组件,广泛适用于各种不同应用场景的 TCP/UDP 通信系统, 提供 C/C 、 C#、 Delphi、 E(易语言)、 Java、 Python 等编程语言接口。 HP-Socket 对通信层完全封装, 应用程序不必关注通信层的任何细节; HP-Socket 提供基于 事件通知模型的 API 接口,能非常简单高效地整合到新旧应用程序中。 为了让使用者能方便快速地学习和使用 HP-Socket,迅速掌握框架的设计思 想和使用方法,特此精心制作了大量 Demo 示例(如: PUSH 模型示例、 PULL 模型示例、 PACK 模型示例、 性能测试示例以及其它编程语言示例)。 HP-Socket 目前运行在 Windows 平台,将来会实现跨平台支持
    2021-08-20 00:31:53下载
    积分:1
  • 类似QQ的全套聊天系统
    类似QQ的全套聊天系统
    2013-02-02下载
    积分:1
  • File
    C# UDP 文件发送,包含丢包重发,不同机器也可以传输文件,可以扩展到多个人重发,多线发送等(Send C# UDP files, including packet loss retransmission, different machine can also transfer files, can be extended to multiple individual retransmission, multi line transmission etc.)
    2014-10-22 14:58:44下载
    积分:1
  • Syndication实现读取、创建、订阅、更新Rss例子 附完整源码下载
    该实例主要目的是了解Syndication,并实现了如下功能                                                           一、了解RSS源     二、RSS源格式     三、如何创建RSS源     四、如何订阅RSS源      五、如何更新RSS源
    2020-10-18 18:27:27下载
    积分:1
  • Qt 瑞士军刀开发工具
    以下都为转载供学习,如有侵权请联系删除~~~  里面的注释也写的挺全的,希望对大家有所帮助~~ 基于qt5的串口网络调试工具        我又回来啦!        发布历史:        v3.3.0 2020年11月27日(添加了modbus调试功能,支持串口主机,串口从机,tcp服务器及tcp客户端)        v3.2.0 2020年10月28日        v3.1.0 2020年07月16日        v3.0.0 2020年06月12日                v2.2.0 2019年11月17日                v2.1.0 2019年10月27日        v2.0.0 2019年09月15日        v1.2.2 2019年04月19日        v1.2.1 2019年03月22日        v1.2.0 2019年03月22日            v1.1.0 2019年03月10日        v1.0.0 2019年02月23日        软件基于Qt5开发,取名为“瑞士军刀”。目前支持串口调试,udp调试,tcp客户端调试,tcp服务器调试,websocket客户端调试,websocket服务器调试及modbus调试,其中modbus支持串口主机,串口从机,tcp客户端及tcp服务器。软件免费,项目开源,可在github或者gitee下载:        可在GitHub下载最新构建·:        https://github.com/qsaker/QtSwissArmyKnife        天朝子民欢迎使用Gitee:        https://gitee.com/qsaker/QtSwissArmyKnife        Qt5.6,Qt5.9,Qt5.12及Qt5.15可编译通过。 软件用户交流群:952218522,Qt技术交流群:723516989。欢迎提供反馈建议,欢迎共同探讨技术。 [attachment=22098]/* * Copyright 2020 Qter(qsaker@qq.com). All rights reserved. * * The file is encoded using "utf8 with bom", it is a part * of QtSwissArmyKnife project. * * QtSwissArmyKnife is licensed according to the terms in * the file LICENCE in the root of the source code directory. */
    2021-05-06下载
    积分:1
  • curl-7.65.1
    说明:  Duilib 是一款强大的界面开发工具,可以将用户界面和处理逻辑彻底分离,极大地提高用户界面的开发效率,遵循bsd协议。(Duilib is a powerful interface development tool, which can completely separate the user interface and processing logic, greatly improve the development efficiency of user interface, and follow the BSD protocol.)
    2020-06-19 19:40:02下载
    积分:1
  • C#Socket
    Socket服务端与客户端通信demo。(Socket server communicates with client demo.)
    2020-06-18 04:00:01下载
    积分:1
  • kmeans_wsn
    无线传感器网络中使用kmeans算法对网络节点进行分簇(wsn kmeans)
    2020-12-07 22:19:20下载
    积分:1
  • 696518资源总数
  • 106259会员总数
  • 28今日下载