WCF支持WebGet属性相关应用技术

开发 开发工具
我们今天将会在这篇文章中以一段代码示例的解读来为大家详细介绍一下WCF支持WebGet属性的实现方法,帮助大家获得一些帮助。

WCF开发工具是由微软开发的一个.NET Framework 3.5的重要组成部分。其中,它功能强大的优势在开发领域中占据着重要地位。在这里我们会为大家详细介绍一下有关WCF支持WebGet属性的相关应用。#t#

看着别人把WCF服务和web请求结合一起用很爽,可是自己怎么也配置不出来(没有用web host),所以研究了一下wcf的binding的配置

endpoint的 binding必须为webHttpBinding.

Endpoint的behavior中要加入webhttp.

WCF支持WebGet属性示例配置文件如下:

 

  1. < ?xml version="1.0" encoding="utf-8" ?>   
  2. < configuration>   
  3. < system.web>   
  4. < compilation debug="true" />   
  5. < /system.web>   
  6. < !-- When deploying the service library project, the content 
    of the config file must be added to the host's   
  7. app.config file. System.Configuration does not support config 
    files for libraries. --
    >   
  8. < system.serviceModel>   
  9. < services>   
  10. < service name="Services.PlayerService" behaviorConfiguration="bh">   
  11. < host>   
  12. < baseAddresses>   
  13. < add baseAddress = "http://localhost:8731/PlayerService/" />   
  14. < /baseAddresses>   
  15. < /host>   
  16. < !-- Service Endpoints -->   
  17. < !-- Unless fully qualified, address is relative to base 
    address supplied above --
    >   
  18. < endpoint address ="" binding="basicHttpBinding" contract=
    "Contrat.IPlayerService" behaviorConfiguration="web">< /endpoint>   
  19. < !-- Metadata Endpoints -->   
  20. < !-- The Metadata Exchange endpoint is used by the service 
    to describe itself to clients. --
    >   
  21. < !-- This endpoint does not use a secure binding and should 
    be secured or removed before deployment --
    >   
  22. < endpoint address="mex" binding="mexHttpBinding" 
    contract="IMetadataExchange"/>   
  23. < /service>   
  24. < /services>   
  25. < behaviors>   
  26. < endpointBehaviors>   
  27. < behavior name="web">   
  28. < webHttp/>   
  29. < /behavior>   
  30. < /endpointBehaviors>   
  31. < serviceBehaviors>   
  32. < behavior name="bh">   
  33. < !-- To avoid disclosing metadata information, set the value 
    below to false and remove the metadata endpoint above 
    before deployment --
    >   
  34. < serviceMetadata httpGetEnabled="True"/>   
  35. < !-- To receive exception details in faults for debugging 
    purposes, set the value below to true. Set to false before 
    deployment to avoid disclosing exception information --
    >   
  36. < serviceDebug includeExceptionDetailInFaults="False" />   
  37. < /behavior>   
  38. < /serviceBehaviors>   
  39. < /behaviors>   
  40. < /system.serviceModel>   
  41. < /configuration>  

 

以上就是对WCF支持WebGet属性的相关介绍。

责任编辑:曹凯 来源: 博客园
相关推荐

2009-12-23 09:26:56

ADO.NET属性

2010-03-10 13:59:40

Python异常处理

2009-12-23 17:18:45

WPF Attache

2009-12-29 10:22:34

WPF附加属性

2009-12-29 10:11:56

WPF布局属性

2011-08-16 15:04:15

交换机快速启动

2010-01-11 15:43:06

VB.NET类属性

2011-05-30 09:17:18

光纤

2023-01-06 19:02:23

应用技术

2015-06-02 10:08:51

布线技术光纤

2010-03-11 15:01:52

Python源码

2010-04-14 16:24:44

宽带无线接入

2015-09-01 10:14:21

机房直冷优化

2009-12-21 18:10:50

WCF实现事件通知

2010-02-26 17:51:16

Silverlight

2010-02-04 17:05:53

C++动态创建对象

2009-09-03 14:14:52

RHEL ASMySQLroot密码

2021-09-13 14:39:34

云计算Edge云应用

2010-02-26 13:26:55

WCF消息编码器

2014-12-09 10:48:12

openstacknovaNUMA
点赞
收藏

51CTO技术栈公众号