使用自定义tcp绑定

时间:2015-10-05 17:01:03

标签: c# wcf tcp configuration

我有一个自定义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 个答案:

答案 0 :(得分:1)

我认为你想要的是

SELECT b.* 
FROM   books_table b 
WHERE  b.is_hardcover = 1 AND
       NOT EXISTS (SELECT * 
                   FROM   keywords_table k 
                   WHERE  b.book_id = k.book_id AND 
                          k.keyword_id IN (1,2,3))

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