WCF相关

本文介绍了Windows Communication Foundation (WCF),一种面向服务编程的技术,详细解释了其与传统WebService的区别及如何通过IIS7进行部署。文章还探讨了WCF的服务配置方法,包括endpoint、binding和服务行为(serviceBehavior),并介绍了一种基于HTTPS的安全令牌传输方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 WCF是.net框架中的一个部分,是面向服务编程的一种技术方式,和以往的webservice技术不同的是,它是microsoft希望的集大成者,希望也确实是综合了以往的webservice技术。

 

WCF的服务是.svc为后缀的文件,宿主既可以是IIS,控制台程序,也还有各种各种多样的。开发的时候一般是用控制台程序控制和开发.

 

寄宿在IIS7上的WCF服务,暴露在endpoint下的是有一个.svc服务,一个web.config配置文件

 

IIS全过程:

client------proxy class------(endpoint)------host(web.config+.svc)------service

 

WCF拥有两种配置服务的方法:

在代码段中设置 和 在配置文件中设置

这些在MSDN上都有具体的说明

 

配置文件:

有endpoint+binding+serviceBehavior

endpoint:service暴露给client端得就叫endpoint

binding:client和service的连接通道的规则就叫binding

               其中包含很多种binding,大概有20几种,有的按照传输方式分:HTTPbinding,TCPBinding,有的按照安全性分:WS2007Binding等等,还有一种是最常用的:customerBinding,就是客户自定义的binding

serviceBehavior:服务执行前所自动做的操作

 

在HTTPS的传输协议上,有一种securityToken的传输方式:

这种传输方式是一种比较复杂的方式,简而言之,client端先向STS请求Token,然后使用Token和Service进行通信

The previous diagram shows a claims-aware Web service (the relying party application) and a smart client that wants to use that service. The RP exposes a policy that describes its addresses, bindings, and contracts. But the policy also includes a list of claims that the RP needs, such as user name, e-mail address, and role memberships. The policy also tells the smart client the address of the STS from which it should retrieve these claims. After retrieving this policy (1), the client now knows where to go to authenticate: the STS. The user presents credentials (2) and the smart client makes a web service request (3) to the STS, requesting the claims that the RP asked for in its policy. The job of the STS is to authenticate the user and return a security token that gives the RP all of the claims it needs. The smart client then makes its request to the relying party (4), sending the security token along in the security SOAP header. The RP now receives claims with each request, and simply rejects any requests that don’t include a security token from the issuing authority that it trusts.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值