欢迎来到飞鸟慕鱼博客,开始您的技术之旅!
当前位置: 首页知识笔记正文

Title: Let your wcf service support the WebGet attribute. It's cool for

终极管理员 知识笔记 74阅读

It depends on others combining WCF service with network request, but he can't configure it himself (without network host), so he studied the binding configuration endpoint of WCF, which must be webHttpBinding. Add webhttp to the behavior of the endpoint. The sample configuration file is as follows: XML version=' 1.0' encoding=' UTF-8' configure system. WebCompilationDebug=' true '//system。 Web! -When deploying the service library project, add the contents of config to the host's. (0,128,0,1)' app.config file. System. The configuration file of the library is not supported. -system . service model Services service name=' Services。 Player service' behavior configuration=' BH' host base address

style="font-family: 新宋体; font-size: 9pt"> <add baseAddress = "" />

</baseAddresses>

</host>

<!-- Service Endpoints -->

<!-- Unless fully qualified, address is relative to base address supplied above -->

<endpoint address ="" binding="basicHttpBinding" contract="Contrat.IPlayerService" behaviorConfiguration="web"></endpoint>

<!-- Metadata Endpoints -->

<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->

<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

</service>

</services>

<behaviors>

<endpointBehaviors>

<behavior name="web">

<webHttp/>

</behavior>

</endpointBehaviors>

<serviceBehaviors>

<behavior name="bh">

<!-- To avoid disclosing metadata information,

set the value below to false and remove the metadata endpoint above before deployment -->

<serviceMetadata httpGetEnabled="True"/>

<!-- 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 -->

<serviceDebug includeExceptionDetailInFaults="False" />

 

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

</configuration>

标签:
声明:无特别说明,转载请标明本文来源!