2015-10-05 38 views
0

我有一个自定义的TCP绑定我想测试上的服务,特别是要禁用安全:使用自定义的TCP绑定

<bindings> 
    <netTcpBinding> 
    <binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" > 
     <security mode="None"></security> 
    </binding> 
    </netTcpBinding> 
</bindings> 

然而,在使用TCP绑定的名字在配置我收到此错误:

Severity Code Description Project File Line 
Warning  The 'binding' attribute is invalid - The value 'customTcpBinding' is invalid according to its datatype 'serviceBindingType' - The Enumeration constraint failed. Server C:\Users\Totally Not Beau\documents\visual studio 2015\Projects\WCF Proj\WCF Proj\App.config 24 

端点配置:

 <endpoint 
      address="" 
      binding="customTcpBinding" 
      bindingConfiguration="" 
      contract="Server.IMyService"> 
     </endpoint> 

整个文件,如果有帮助:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> 
    </startup> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name=""> 
      <serviceMetadata httpGetEnabled="false" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <netTcpBinding> 
     <binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" > 
      <security mode="None"></security> 
     </binding> 
     </netTcpBinding> 
    </bindings> 
    <services> 
     <service name="Server.MyService"> 
      <endpoint address="" binding="customTcpBinding" bindingConfiguration="" 
       contract="Server.IMyService"> 
      </endpoint> 
      <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" 
       contract="IMetadataExchange" /> 
      <host> 
       <baseAddresses> 
        <add baseAddress="net.tcp://192.168.2.7:8732/MyService/" /> 
       </baseAddresses> 
      </host> 
     </service> 
    </services> 
</system.serviceModel> 
</configuration> 

任何意见将不胜感激!

回答

1

我想你想要的是

<endpoint 
    address="" 
    binding="netTcpBinding" 
    bindingConfiguration="customTcpBinding" 
    contract="Server.IMyService"> 
</endpoint> 

您可能必须得指定实际的地址,我还不能肯定。

+0

谢谢,显然不需要指定地址。这工作完美。 :D现在启用双工支持。 – user5389897