WCF禁用安全配置指导手册

WCF中具有安全配置。不过,在实际使用中我们有时会碰到需要关闭这一安全配置的环境。今天我们就来为大家介绍一下有关WCF禁用安全配置的相关知识。#t#

时不时会用到这个WCF禁用安全配置方法,写在这里,以免忘记了又满天找。

 

  1. < ?xml version="1.0" encoding="utf-8" ?> 
  2. < configuration> 
  3. < system.web> 
  4. < compilation debug="true" /> 
  5. < /system.web> 
  6. < system.serviceModel> 
  7. < services> 
  8. < service name="CertificateTest
    .Service.CalService"
       
  9. behaviorConfiguration="CalServiceBeConfig"> 
  10. < host> 
  11. < baseAddresses> 
  12. < add baseAddress = "http://localhost:8888/" /> 
  13. < /baseAddresses> 
  14. < /host> 
  15. < !--指定endpoint的bindingConfiguration属性--> 
  16. < endpoint address ="CalService"   
  17. binding="wsHttpBinding" 
  18. contract="CertificateTest.
    Contract.ICalService"
     
  19. bindingConfiguration="noSecBinding"> 
  20. < identity> 
  21. < /identity> 
  22. < /endpoint> 
  23. < /service> 
  24. < /services> 
  25. < behaviors> 
  26. < serviceBehaviors> 
  27. < behavior name="CalServiceBeConfig" > 
  28. < serviceMetadata httpGetEnabled="True"/> 
  29. < serviceDebug includeException
    DetailInFaults
    ="False" /> 
  30. < /behavior> 
  31. < /serviceBehaviors> 
  32. < /behaviors> 
  33. < !--在binding这里禁用安全性--> 
  34. < bindings> 
  35. < wsHttpBinding> 
  36. < binding name="noSecBinding"> 
  37. < security mode="None">< /security> 
  38. < /binding> 
  39. < /wsHttpBinding> 
  40. < /bindings> 
  41. < /system.serviceModel> 
  42. < /configuration> 

以上就是WCF禁用安全配置相关技巧讲解。

THE END