兩個(gè)基本W(wǎng)CF應(yīng)用技巧總結(jié)
在學(xué)習(xí)WCF開(kāi)發(fā)工具的過(guò)程中,我們需要在不斷的實(shí)踐中去慢慢積累經(jīng)驗(yàn),來(lái)充實(shí)我們所掌握的應(yīng)用技巧,這樣才能應(yīng)用于自如。在這里我們就為大家介紹兩種常見(jiàn)的WCF應(yīng)用技巧,方便大家掌握。#t#
WCF應(yīng)用技巧1、生成證書(shū)
makecert -r -pe -n CN="MyWebServer" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine -sky exchange
-sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
WCF應(yīng)用技巧2、config配置
- < endpoint address ="" binding="wsHttpBinding"
contract="WcfService.IService1"
bindingConfiguration="EndpointBinding">
部署時(shí),應(yīng)刪除或替換下列標(biāo)識(shí)元素,以反映在其下運(yùn)行部署服務(wù)的標(biāo)識(shí)。刪除之后,WCF 將自動(dòng)推導(dǎo)相應(yīng)標(biāo)識(shí)。
- < identity>
- < dns value="MyWebServer"/>
- < /identity>
- < /endpoint>
與
- < bindings>
- < wsHttpBinding>
- < binding name="EndpointBinding">
- < security mode="Message">
- < transport clientCredentialType="Windows"
proxyCredentialType="Windows"/>- < message clientCredentialType="UserName"/>
- < /security>
- < /binding>
- < /wsHttpBinding>
- < /bindings>
- < serviceCredentials>
- < serviceCertificate findValue="MyWebServer"
- x509FindType="FindBySubjectName"
- storeLocation="LocalMachine"
- storeName="My"/>
- < userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="WcfService.Models.
CustomUserPassword,WcfService" />- < /serviceCredentials>
以上就是我們?yōu)榇蠹铱偨Y(jié)的WCF應(yīng)用技巧。