WCF传byte[]的方法

如果想让WCF传输byte[]数组,那么需要使用Mtom。bingding可以是wsDualHttpBinding (这个用于双工,也就是需要回掉的情形)或 wsHttpBinding.  


<system.serviceModel>

    <bindings>

      <wsDualHttpBinding>

        <binding name="myBinding" messageEncoding="Mtom"/>

      </wsDualHttpBinding>

    </bindings>

    

    <services>

      <service name="WCFParkPacketServiceLibrary.SendParkPacketService" behaviorConfiguration="ParkPacketServiceBehavior">

        <host>

          <baseAddresses>

            <add baseAddress="http://localhost:3330/ParkService/packet/" />

          </baseAddresses>

        </host>

        <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="myBinding" contract="WCFParkPacketServiceLibrary.ISendParkPacketService" />

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

      </service>

    </services>


    <behaviors>

      <serviceBehaviors>

        <behavior name="ParkPacketServiceBehavior">

          <serviceMetadata httpGetEnabled="False"/>

          <serviceDebug includeExceptionDetailInFaults="False"/>

        </behavior>

      </serviceBehaviors>

    </behaviors>

    

  </system.serviceModel>


你可能感兴趣的:(byte,WCF,mtom)