资源简介
部分win7/win8用户 运行时报错 可能是 权限问题,所以运行项目的时候 要右键>>以管理员身份运行
部分用户 运行该项目的时候 可能提示:协定需要双工 但是绑定 NetTcpBinding 不支持
这是只需要将host项目app.config中协议部分 改为wsDualHttpBinding 即可,如下代码:
<service name="WcfUploadServiceLib.UpLoadService"> <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="DualHttpBinding" contract="WcfUploadServiceLib.IUpLoadService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8890/WcfUploadService/" /> <add baseAddress="net.tcp://localhost:8888/WcfUploadService/" /> </baseAddresses> </host> </service>
另外使用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 { /// <summary> /// The main entry point for the application. /// </summary> [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(); } } } }
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WcfUploadClient
{
public class CallbackImpl : WcfUploadSvc.IUpLoadServiceCallback
{
public event Action OnUploadProcess;
public void OnProcess(WcfUploadSvc.UpLoadProcessEventArgs args)
{
if (OnUploadProcess != null)
OnUploadProcess(args);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-09-26 00:08 WcfUploadService\
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\
文件 1748 2011-06-07 14:37 WcfUploadService\WcfUploadClient\app.config
目录 0 2012-09-06 23:43 WcfUploadService\WcfUploadClient\bin\
文件 473 2011-01-23 23:05 WcfUploadService\WcfUploadClient\CallbackImpl.cs
文件 2347 2011-01-24 00:12 WcfUploadService\WcfUploadClient\Form1.cs
文件 5127 2011-01-23 23:57 WcfUploadService\WcfUploadClient\Form1.Designer.cs
文件 6020 2011-01-23 23:57 WcfUploadService\WcfUploadClient\Form1.resx
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\obj\
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\obj\x86\
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\obj\x86\Debug\
文件 4440 2011-01-24 21:20 WcfUploadService\WcfUploadClient\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7753 2011-06-07 14:37 WcfUploadService\WcfUploadClient\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 678 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\GenerateResource.read.1.tlog
文件 1618 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\GenerateResource.write.1.tlog
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\obj\x86\Debug\TempPE\
文件 8192 2011-01-24 00:12 WcfUploadService\WcfUploadClient\obj\x86\Debug\TempPE\Service References.WcfUploadSvc.Reference.cs.dll
文件 3102 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\WcfUploadClient.csproj.FileListAbsolute.txt
文件 14848 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\WcfUploadClient.exe
文件 180 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\WcfUploadClient.Form1.resources
文件 40448 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\WcfUploadClient.pdb
文件 180 2011-06-07 14:35 WcfUploadService\WcfUploadClient\obj\x86\Debug\WcfUploadClient.Properties.Resources.resources
文件 507 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Program.cs
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\Properties\
文件 1442 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Properties\AssemblyInfo.cs
文件 2856 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Properties\Resources.Designer.cs
文件 5612 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Properties\Resources.resx
文件 1098 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Properties\Settings.Designer.cs
文件 249 2010-12-30 12:53 WcfUploadService\WcfUploadClient\Properties\Settings.settings
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\Service References\
目录 0 2011-09-26 00:08 WcfUploadService\WcfUploadClient\Service References\WcfUploadSvc\
............此处省略55个文件信息
- 上一篇:c# 多线程
- 下一篇:wcf 通过修改header 验证访问权限的两种方式
相关资源
- 疯子ftp上传工具源码传送数据到服务
- 猜数小游戏WCF网络编程技术(附服务
- 控制台 ProgressBar进度条
- C# WCF简单测试
- asp.net 多文件上传源码
- WcfRestFull 开发模式
- Html文件上传控件(整理前台使用版)
- web api 文件管理器(附文件上传以及
- asp.net 上传文件至wps
- kindeditor编辑器 黏贴图片自动上传插件
- js实现 点击图片实现 图片上传 源码
- html5简单进度条效(progressbar)
- wcf restful简单实现代码
- 根据文件大小显示文件复制进度条
- 弹出模式窗口显示进度条
- 通过POI预览文件(上传空间demo)
- 构建WCF面向服务的应用程序系列课程
- Progressbar进度条控件
- 定时读取ftp中txt日志并转存,判断后
- wpf自定义进度条
- kindeditor编辑器上传图片
- C#Webservice+微信小程序上传多个文件笔
- DemoSwfUpload 比较好用的上传控件
- 1252056375_ddvip_2352 C#下基于WCF的聊天程
- ftp ftp定时自动上传文件到服务器上
- WPF-Self-study-manual 该上传内容是WPF自学
- CSharp_WCF C# WCF的精简版本
- Ajax-Uploader c#上传文件的控件
- FTP实现文件的上传,,删除等功能
- C#多张图片上传
评论
共有 条评论