WCF 安全性 之 Windows
案例下载
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的更多相关文章
- WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一)
上接 WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) 七 WCF服务的Windows 服务程序寄宿 这种方式的服务寄宿,和IIS一样有一个一样 ...
- WCF寄宿到Windows Service
WCF寄宿到Windows Service[1] 2014-06-14 WCF寄宿到Windows Service参考 WCF寄宿到Windows Service 返回 在前面创建一个简单的WCF程序 ...
- WCF寄宿到Windows Service[1]
WCF寄宿到Windows Service 返回 在前面创建一个简单的WCF程序,我们把WCF的服务寄宿到了Host这个控制台项目中了.下面将介绍如何把WCF的服务寄宿到Windows服务中(源代码) ...
- WCF 部署在Windows 2012 IIS上各种报错的解决方法
1.由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本 ,请添加处理程序.如果勇载文件,请添加 MIME 映射. 以管理员身份,在cmd中运行C:\Windows\Microsoft.NET\F ...
- WCF 下的windows服务的安装卸载
安装:启动vs2010(如果是win2008要以管理员来启动)命令:installutil demo.exe 卸载:先在服务里停止这个服务,然后启动vs2010(如果是win2008要以管理员来启动) ...
- WCF服务寄宿Windows
windows服务的介绍 Windows服务应用程序是一种需要长期运行的应用程序,它对于服务器环境特别适合.它没有用户界面,并且也不会产生任何可视输出.任何用户消息都会被写进Windows事件日志.计 ...
- 使用C#创建及调用WCF完整实例 (Windows服务宿主)
关于WCF的概念.原理.优缺点等,在这里就不多说了,网上很多,可以自行搜索,比我解释的要专业的多. 这里直接说使用Windows 服务(Windows Service)作为宿主如何实现,其它方式不在此 ...
- WCF 安全性之 自定义用户名密码验证
案例下载 http://download.csdn.net/detail/woxpp/4113172 客户端调用代码 通过代理类 代理生成 参见 http://www.cnblogs.com/woxp ...
- WCF 安全性 之 自定义证书验证
案例下载 http://download.csdn.net/detail/woxpp/4113172 客户端调用代码 通过代理类 代理生成 参见 http://www.cnblogs.com/woxp ...
随机推荐
- Unity.Interception(AOP)
在前面我们学习到的是Unity依赖注入(DI)与统一容器来松散耦合,这个设计已经对我们系统带来了很多的好处.但是我们还会想尝试和遵循单一职责,开放封闭原则.比如我们不应该在我们的Bus ...
- Day 1 T1
题目描述 小南有一套可爱的玩具小人, 它们各有不同的职业. 有一天, 这些玩具小人把小南的眼镜藏了起来. 小南发现玩具小人们围成了一个圈,它们有的面朝圈内,有的面朝圈外.如下图: 这时singer告诉 ...
- Java IO 操作(一)
(1)File 类的基础用法 // 1.创建 一个file 对象File file = new File("D:\\aaa");// 2.判断此 file 是否是一个文件夹file ...
- 第二天 ci执行流程
第二天 ci执行流程 welcome 页面 this this->load 单入口框架index.php 两个文件夹 system application定义 定义常亮路径 载入 codeign ...
- Codeforces Round #345 (Div. 1) A. Watchmen
A. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...
- 网站开发网页广告条不显示,出现ERR_BLOCKED_BY_CLIENT
原因: 原因很简单,是因为被360浏览器的ad block给屏蔽掉了. 现象: 解决方案: 更换图片文件名,去掉ad,改成其他的字符.
- Shell运算符:Shell算数运算符、关系运算符、布尔运算符、字符串运算符等
摘自:http://c.biancheng.net/cpp/view/2736.html
- Python学习笔记(1)
从今天开始正式学习python,教程看的是廖雪峰老师的Python 2.7教程.链接在此:http://www.liaoxuefeng.com/wiki/0014316089557264a6b3489 ...
- oracle plsql 无法连接 报 ORA-12560: TNS:protocol adapter error
ORA-12560: TNS:protocol adapter error 添加一个环境变量,名为TNS_ADMIN,值为 tnsnames.ora 文件所在路径.比如我的本机为:D:/instant ...
- 转:CentOS, 找不到dump命令:command not found
dump 功能说明:备份文件系统.语 法:dump [-cnu][-0123456789][-b <区块大小>][-B <区块数目>][-d <密度>][-f &l ...