兩個基本WCF應用技巧總結
在學習WCF開發工具的過程中,我們需要在不斷的實踐中去慢慢積累經驗,來充實我們所掌握的應用技巧,這樣才能應用于自如。在這里我們就為大家介紹兩種常見的WCF應用技巧,方便大家掌握。#t#
WCF應用技巧1、生成證書
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應用技巧2、config配置
- < endpoint address ="" binding="wsHttpBinding"
contract="WcfService.IService1"
bindingConfiguration="EndpointBinding">
部署時,應刪除或替換下列標識元素,以反映在其下運行部署服務的標識。刪除之后,WCF 將自動推導相應標識。
- < 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>
以上就是我們為大家總結的WCF應用技巧。