WCF/WF - Error streaming over WCF - Asked By Justin P on 25-Mar-11 10:21 AM

Earn up to 20 extra points for answering this tough question.
I have been trying to set up streaming of files with a simple WCF service. It has two basic operations: upload and download. I continuously get the following error:

Content Type multipart/related;
type="application/xop+xml";start="<http://tempuri.org/p>";boundary="uuid:eb090162-5a98-4569-937b-63baaad88ee3+id=1";start-info="text/xml" was not supported by service http://localhost/FileService/Service1.svc. The client and service bindings may be mismatched.

I have been round and round looking for a solution. I still have not found one. Any help is appreciated. I have attached my client and service config files

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
  <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IFileTransferService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None"
        realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://localhost/FileService/Service1.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransferService"
    contract="FileServiceReference.IFileTransferService" name="BasicHttpBinding_IFileTransferService" />
  </client>
  </system.serviceModel>
</configuration>


<?xml version="1.0"?>
 
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
 
  <system.serviceModel>
  <behaviors>
    <serviceBehaviors>
    <behavior name="serviceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"
            httpHelpPageEnabled="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
    </serviceBehaviors>
  </behaviors>
  <services>
    <service behaviorConfiguration="serviceBehavior"
         name="FileTransferService">
    <endpoint address=""
          name="basicHttpStream"
          binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IFileTransferService"
          contract="IFileTransferService">
    </endpoint>
    <endpoint address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange">
    </endpoint>
    </service>
  </services>
  <bindings>
    <basicHttpBinding>
    <binding name="httpLargeMessageStream"
         maxBufferSize="2147483647"
         maxReceivedMessageSize="2147483647"
         transferMode="Streamed"
         messageEncoding="Mtom">
      <security mode ="None">
      <transport clientCredentialType="None"></transport>
      </security>
    </binding>     
    <binding name="BasicHttpBinding_IFileTransferService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None"
        realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
    </basicHttpBinding>
  </bindings>
  </system.serviceModel>
  <system.web>
  <httpRuntime maxRequestLength="2147483647"/>
  </system.web>
</configuration>
Mash B replied to Justin P on 28-Mar-11 02:43 PM
to upload and download file you need to transfer it as a byte stream. Look at this example from MSDN

http://msdn.microsoft.com/en-us/library/ms789010.aspx

and article

http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html
Justin P replied to Justin P on 28-Mar-11 02:49 PM
Those were two of the examples I was using to base my project on. I was streaming. Did you notice anything with what i showed that would relate to the error?