title: Bad Request calling WCF service passing byte array
body: <p>I am new to StackOverflow so forgive me if I get this wrong. I am getting a bad request error when calling a wcf service. The method takes a Byte array as a parameter. It works on small files but not on files that are 80000 bytes in length. I have posted the web config files below.</p>
  
  <p>This is in my web config file</p>
  
  <pre><code>    &lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;basicHttpBinding&gt;
      &lt;binding name="BasicHttpBinding_IFileService" 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="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true"&gt;
        &lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /&gt;
        &lt;security mode="None"&gt;
          &lt;transport clientCredentialType="None" proxyCredentialType="None"
            realm="" /&gt;
          &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/basicHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;client&gt;
    &lt;endpoint address="http://localhost:4199/FileService.svc" binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IFileService" contract="ConStringServices.IFileService"
      name="BasicHttpBinding_IFileService" /&gt;
  &lt;/client&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is in my service web config file</p>
  
  <pre><code>    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="basicBinding" maxReceivedMessageSize="2147483647"&gt;
                  &lt;readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/&gt;
              &lt;/binding&gt;              
          &lt;/basicHttpBinding&gt;         
      &lt;/bindings&gt;
      &lt;services&gt;
          &lt;service behaviorConfiguration="MyServiceBehavior" name="MyService"&gt;
              &lt;endpoint  bindingConfiguration="basicBinding" address="" binding="basicHttpBinding" contract="ConStringTest.Services.IFileService"&gt;
                  &lt;identity&gt;
                      &lt;dns value="localhost" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;             
          &lt;/service&gt;          
      &lt;/services&gt;
      &lt;behaviors&gt;
          &lt;serviceBehaviors&gt;
              &lt;behavior name="MyServiceBehavior"&gt;
                  &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                  &lt;serviceMetadata httpGetEnabled="true"/&gt;
                  &lt;!-- 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 --&gt;
                  &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
              &lt;/behavior&gt;
          &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p><strong>Update:</strong> This is the method that is called within the service. Like I said, it works with small files.</p>
  
  <pre><code>    public Boolean UploadFile(Byte[] file, string filename)
      {
          FileStream stream = new FileStream("C:\\Temp\\" + filename, FileMode.Create, FileAccess.ReadWrite);
          stream.Write(file, 0, file.Length);
          stream.Close();
  
          Console.WriteLine(file.Length);
          return true;
      }
  </code></pre>
  
  <p>What am I doing wrong? Any help would be greatly appreciated.
  Update: I have amended the service config file as above but still no joy.
  <strong>Update:</strong> It is fixed. I just had to make the service name the Fully Qualified Name with namespace. ie. ConStringTest.Services.FileService</p>