2009-01-15 69 views
9

什么是我需要为app.config中的精简WCF配置所做的最小客户端设置?WCF最小客户端app.config设置

默认的一个是这样的:

<bindings> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IService" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
       allowCookies="false"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <reliableSession ordered="true" inactivityTimeout="00:10:00" 
        enabled="false" /> 
       <security mode="Message"> 
        <transport clientCredentialType="Windows" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="Windows" negotiateServiceCredential="true" 
         algorithmSuite="Default" establishSecurityContext="true" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 

我能排除,以及如何这么多我需要?


编辑:我应该只是开始剥开的部分,直到它打破?我希望找到一些很好的优化wsHttpBindings,人们有好运。

+0

从问题来看,我们是否应该从服务器或客户端的角度来阐述。最小配置可能不同。无论如何,我猜想不需要任何绑定配置。如果没有任何绑定配置,WCF客户端和服务器*都可以工作得很好。根据问题是针对客户端还是服务器,最小配置可以是“”或“”元素。 – 2016-03-04 14:22:28

回答

8

Jerograv是正确的,因为这些都是默认设置,你可以省略所有这些。 为了测试这一点,我已经创建了一个简单的服务,创造所需的最低配置是相当多的地址,绑定和合约─

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.serviceModel> 
     <client> 
      <endpoint address="http://sabra2/TestService/Service1.svc" binding="wsHttpBinding" 
       contract="IService1"/> 
     </client> 
    </system.serviceModel> 
</configuration> 
+0

完美,谢谢! – 2009-01-16 16:25:57

4

我想你会发现所有的都是可选的。无论如何,在特定绑定中的所有这些事情都是默认设置。

事实上,我认为在这种情况下,在端点中指定绑定是可选的。

7

只要记住WCF的ABC的。地址,装订,合同。这就是你需要的全部!

您的客户端只需要有一个端点与WCF服务交谈。每个端点只需要描述每一个ABC,然后你就完成了。其他的东西可以稍后添加。

这是我不喜欢在Visual Studio中添加服务引用的一个原因。