wcf 基本配置

Posted jonney

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wcf 基本配置相关的知识,希望对你有一定的参考价值。

 1   <system.serviceModel>
 2     <services>
 3       <service name="ServiceUpdater.ServiceUpdate" behaviorConfiguration="http" >
 4         <host>
 5           <baseAddresses>
 6             <add baseAddress="http://localhost:7777/Updater"/>
 7           </baseAddresses>
 8         </host>
 9         <endpoint binding="webHttpBinding" contract="ServiceUpdater.IServiceUpdate" behaviorConfiguration="web"></endpoint>
10       </service>
11             
12       <service name="HangerService.Hanger" behaviorConfiguration="http" >
13         <host>
14           <baseAddresses>
15             <add baseAddress="http://localhost:7777/Hanger"/>
16           </baseAddresses>
17         </host>
18         <endpoint binding="webHttpBinding" contract="HangerService.IHanger" behaviorConfiguration="web" bindingConfiguration="webBinding"></endpoint>
19       </service>
20       
21       <service name="Dade.DataCenter.CutBoard.Bll.Service" behaviorConfiguration="http">
22         <host>
23           <baseAddresses>
24             <add baseAddress="http://localhost:7777/CutBoard"/>
25           </baseAddresses>
26         </host>
27         <endpoint binding="webHttpBinding" contract="Dade.DataCenter.CutBoard.Bll.IService" behaviorConfiguration="web"></endpoint>
28         <endpoint address="123" binding="basicHttpBinding" contract="Dade.DataCenter.CutBoard.Bll.IService"></endpoint>
29       </service>            
30     </services>
31     
32     <behaviors>
33       <serviceBehaviors>
34         <behavior name="mex">
35           <serviceMetadata/>
36         </behavior>
37         <behavior name="http">
38           <serviceMetadata httpGetEnabled="true"/>
39           <serviceDebug includeExceptionDetailInFaults="true"  httpHelpPageEnabled="true"/>
40         </behavior>
41       </serviceBehaviors>
42       
43       <endpointBehaviors>
44         <behavior name="web">
45           <webHttp helpEnabled="true"/>
46         </behavior>
47       </endpointBehaviors>
48     </behaviors>
49     
50     <bindings>
51       <webHttpBinding>
52         <binding name="webBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
53           <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
54         </binding>
55       </webHttpBinding>      
56     </bindings>
57     
58   </system.serviceModel>

 

以上是关于wcf 基本配置的主要内容,如果未能解决你的问题,请参考以下文章

WCF配置问题(配置WCF跨域)

将应用程序配置嵌入到 wcf 中的 c# 代码中

在 IIS 中托管时如何从代码配置 WCF 服务?

使用代码而不是配置文件将消息检查器添加到 WCF 服务

通过C#代码调用WCF服务中的一个方法。不依赖配置文件等。求完整代码!!

如何在代码而不是配置中创建 WCF EndPointBehaviors?