WCF支持WebGet属性相关应用技术
创始人
2024-06-23 14:50:35
0

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属性的相关介绍。

相关内容

热门资讯

PHP新手之PHP入门 PHP是一种易于学习和使用的服务器端脚本语言。只需要很少的编程知识你就能使用PHP建立一个真正交互的...
网络中立的未来 网络中立性是什... 《牛津词典》中对“网络中立”的解释是“电信运营商应秉持的一种原则,即不考虑来源地提供所有内容和应用的...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
粉嫩如何诠释霸道 东芝M805... “霸道粉”是个什么玩意东芝M805拿过来的时候,笔者扑哧笑了,不是笑这款笔记本,而是笑这款产品的颜色...
什么是大数据安全 什么是大数据... 在《为什么需要大数据安全分析》一文中,我们已经阐述了一个重要观点,即:安全要素信息呈现出大数据的特征...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
全面诠释网络负载均衡 负载均衡的出现大大缓解了服务器的压力,更是有效的利用了资源,提高了效率。那么我们现在来说一下网络负载...
如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
30分钟搞定iOS自定义相机 最近公司的项目中用到了相机,由于不用系统的相机,UI给的相机切图,必须自定义才可以。就花时间简单研究...
Intel将Moblin社区控... 本周二,非营利机构Linux基金会宣布,他们将担负起Moblin社区的管理工作,而这之前,Mobli...