Hi i finally created a small upload wcf service. I can transfer small images on my computer, but i tried transferring a mp3 song to have some larger data. It failede with a "400 bad request" exception. I have no clue as to what is going on. I am streaming the data and found alot of resources on the net, but none seem to work, this is what i have as the services web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="67108864"/>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" messageEncoding="Mtom" maxBufferSize="65536" maxReceivedMessageSize="67108864">
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />
</binding>
<!--<binding name="ExampleBinding" transferMode="Streamed" messageEncoding="Mtom" />-->
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
And this is my clients app.config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMediaServer" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:49689/MediaServer.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMediaServer" contract="mediaServer.IMediaServer"
name="BasicHttpBinding_IMediaServer" />
</client>
</system.serviceModel>
</configuration>
As far as i can see i should be able to receive at least 64Mb of data, and the data i try to transfer is around 4Mb. Can anyone point me in the right direction as to what the error is in my configuration (at least i suspect that the error is in my configuration)
EDIT These are my contracts:
[ServiceContract]
public interface IMediaServer
{
[OperationContract]
void UploadData(UploadFile data);
}
[MessageContract]
public class UploadFile
{
public UploadFile() { }
[MessageHeader]
public string FileName { get; set; }
[MessageHeader]
public string Type { get; set; }
[MessageHeader]
public string AccountName { get; set; }
[MessageBodyMember]
public Stream data { get; set; }
}