案例下载

http://download.csdn.net/detail/woxpp/4113172

服务端配置代码

  <system.serviceModel>
<services>
<service name="WcfServiceLibrary.ServiceTcp">
<endpoint address="net.tcp://localhost:8731/WcfServiceLibrary"
binding="netTcpBinding" bindingConfiguration="testnetTcpBinding"
contract="WcfServiceLibrary.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/WcfServiceLibrary" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false 并删除上面的元数据终结点 -->
<serviceMetadata httpGetEnabled="True"/>
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息-->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="testnetTcpBinding">
<security mode="Message">
<transport clientCredentialType="None" protectionLevel="None"></transport>
<message clientCredentialType="Windows"/>
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>

客户端调用代码 通过代理类

http://www.cnblogs.com/woxpp/p/6232298.html

客户端代码

    //获取域名
String hostName = Dns.GetHostName();
IPHostEntry ipH = new IPHostEntry();
ipH = Dns.Resolve(hostName);
NetTcpBinding netTcp = new NetTcpBinding();
netTcp.Security.Mode = SecurityMode.Message;
netTcp.Security.Transport.ProtectionLevel = ProtectionLevel.None;
netTcp.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
netTcp.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
ChannelFactory<IService1> factory = new ChannelFactory<IService1>(netTcp);
factory.Credentials.Windows.ClientCredential.UserName = "panpan.xu";
factory.Credentials.Windows.ClientCredential.Password = "123.xpp";
factory.Credentials.Windows.ClientCredential.Domain = "panpanxu-PC";
IService1 proxy = factory.CreateChannel(new EndpointAddress("net.tcp://localhost:8731/WcfServiceLibrary"));
txtMessage.Text = proxy.GetDataUsingDataContract(new WcfServiceLibrary.CompositeType() { StringValue = "sssss" }).StringValue;

WCF 安全性 之 Windows的更多相关文章

  1. WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一)

    上接    WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) 七 WCF服务的Windows 服务程序寄宿 这种方式的服务寄宿,和IIS一样有一个一样 ...

  2. WCF寄宿到Windows Service

    WCF寄宿到Windows Service[1] 2014-06-14 WCF寄宿到Windows Service参考 WCF寄宿到Windows Service 返回 在前面创建一个简单的WCF程序 ...

  3. WCF寄宿到Windows Service[1]

    WCF寄宿到Windows Service 返回 在前面创建一个简单的WCF程序,我们把WCF的服务寄宿到了Host这个控制台项目中了.下面将介绍如何把WCF的服务寄宿到Windows服务中(源代码) ...

  4. WCF 部署在Windows 2012 IIS上各种报错的解决方法

    1.由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本 ,请添加处理程序.如果勇载文件,请添加 MIME 映射. 以管理员身份,在cmd中运行C:\Windows\Microsoft.NET\F ...

  5. WCF 下的windows服务的安装卸载

    安装:启动vs2010(如果是win2008要以管理员来启动)命令:installutil demo.exe 卸载:先在服务里停止这个服务,然后启动vs2010(如果是win2008要以管理员来启动) ...

  6. WCF服务寄宿Windows

    windows服务的介绍 Windows服务应用程序是一种需要长期运行的应用程序,它对于服务器环境特别适合.它没有用户界面,并且也不会产生任何可视输出.任何用户消息都会被写进Windows事件日志.计 ...

  7. 使用C#创建及调用WCF完整实例 (Windows服务宿主)

    关于WCF的概念.原理.优缺点等,在这里就不多说了,网上很多,可以自行搜索,比我解释的要专业的多. 这里直接说使用Windows 服务(Windows Service)作为宿主如何实现,其它方式不在此 ...

  8. WCF 安全性之 自定义用户名密码验证

    案例下载 http://download.csdn.net/detail/woxpp/4113172 客户端调用代码 通过代理类 代理生成 参见 http://www.cnblogs.com/woxp ...

  9. WCF 安全性 之 自定义证书验证

    案例下载 http://download.csdn.net/detail/woxpp/4113172 客户端调用代码 通过代理类 代理生成 参见 http://www.cnblogs.com/woxp ...

随机推荐

  1. 老生长谈的$.extend()方法

    jq的extend()是jq插件扩展很重要的部分,到这里证明是可以自己在jq的基础上,分为两种方法去扩展或开发,为jq本身添加一个方法,可以理解成扩展静态方法和自定义方法. 今天有看到一篇帖子,对这部 ...

  2. 主机信息收集工具DMitry

    主机信息收集工具DMitry   DMitry是Kali Linux内置的一款信息收集工具.它的目标主要是Web类主机.它不仅通过主动查询.端口扫描方式,还借助第三方网站和搜索引擎获取信息. 它搜集的 ...

  3. 现场打印智能无线PDA安卓POS 条码识别、打印、数据采集销售开单收银管理软件

    现场打印安卓POS 条码识别.打印.数据采集管理软件 案例: 经营日化品牌,从事小型超市和日用品商店的批发配送业务. 公司以前的销售模式:三个业务员负责跑市场,每个人负责一个区域,平均每天每个人要去到 ...

  4. 前端CSS规范整理_转载、、、

    一.文件规范 1.文件均归档至约定的目录中. 具体要求通过豆瓣的CSS规范进行讲解: 所有的CSS分为两大类:通用类和业务类.通用的CSS文件,放在如下目录中: 基本样式库 /css/core 通用U ...

  5. Xmarks Hosts

    使用 Chrome 浏览器,但实在是没精力去各种FQ和寻找 Google 的 hosts 来同步书签,没办法只好折中使用 Xmarks 来单独同步书签,没想到最近 Xmarsks 又不好使了.再次标记 ...

  6. OpenCV(三) 之 基本数据结构 CvMat和 IplImage

    OpenCV(三) 之 基本数据结构 CvMat和 IplImage CvMat IplImage OpenCv中基本的数据类型 类型 参数 表示 CvPoint int x,y 像素点 CvPoin ...

  7. 基于java平台的常用资源整理

    这里整理了基于java平台的常用资源 翻译 from :akullpp | awesome-java 大家一起学习,共同进步. 如果大家觉得有用,就mark一下,赞一下,或评论一下,让更多的人知道.t ...

  8. FastDateFormat

    1 public static final FastDateFormat ISO_DATE_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd&q ...

  9. ANGULAR $HTTP请求【转】

    angular使用post.get向后台传参的问题 一.问题的来源 我们都知道向后台传参可以使用get.put,其形式就类似于name=jyy&id=001.但是在ng中我却发现使用$http ...

  10. MVC项目中ExecutionTimeout不生效的解决方案

    我们做web服务器端开发时,经常会遇到一个需求场景,因为某些耗时处理造成页面的响应处理时间超长,技术角度就想能否给页面处理程序一个指定的超时时间,服务端处理程序执行时间超过这个指定的超时时间则中断处理 ...