title: passing byte array to wcf using soap
body: <p>Here, when i am trying to send byte array it is giving me bad request error. I have checked with maximum values for all message limits. All are set to maximum value.
  However i am able to send string values to service method by keeping byte array parameter as null. I don't know why this happening here. I have also checked the service behavior configuration name and binding configuration names(i.e., included namespace) which seems to be fine.Any help is greatly appreciated. </p>
  
  <p><strong>This is my client side code:</strong></p>
  
  <pre><code>....
  ServiceClient ac = new ServiceClient();
  string ServiceUrl = "http://localhost:20314/Service.svc";
  EndpointAddress address = new EndpointAddress(ServiceUrl);
  BasicHttpBinding httpbinding = new BasicHttpBinding();   
  using (ChannelFactory&lt;IServiceChannel&gt; factory = new   ChannelFactory&lt;IServiceChannel&gt;(httpbinding))
  {
      factory.Endpoint.Address = address;
      using (IServiceChannel oService = factory.CreateChannel())
      {
  
         using (OperationContextScope scope = new OperationContextScope(oService))
         {
  
           Guid myToken = new Guid("guid here");                      
  
           MessageHeader&lt;Guid&gt; mhg = new MessageHeader&lt;Guid&gt;(myToken);                       
           MessageHeader untyped = mhg.GetUntypedHeader("identity", "ns");
           OperationContext.Current.OutgoingMessageHeaders.Add(untyped);
           // here i am getting bad request error                                                               
           var fdt = (oService).GetData(bytearray, value);
  
           }
      }
  }
  .......
  </code></pre>
  
  <p><strong>client web config:</strong></p>
  
  <pre><code>&lt;system.web&gt;
  &lt;compilation debug="true" targetFramework="4.0"/&gt;     
  &lt;httpRuntime maxRequestLength="500000000" executionTimeout="360"/&gt; 
  &lt;/system.web&gt;  
  &lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;basicHttpBinding&gt;        
      &lt;binding name="BasicHttpBinding_IService" closeTimeout="01:01:00"
        openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01: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="4096" 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:20314/Service.svc" binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IService" contract="LocalService.IService"
      name="BasicHttpBinding_IService"/&gt; 
  &lt;/client&gt;
  
  &lt;services&gt;      
    &lt;service name="LocalService.Service" behaviorConfiguration="ServiceBehavior"&gt;
      &lt;endpoint address="http://localhost:20314/Service.svc" binding="wsHttpBinding" contract="LocalService.IService" /&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;        
      &lt;behavior name="ServiceBehavior"&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p> 
  </p>
  
  <p><strong>Service Web Config</strong></p>
  
  <pre><code>&lt;system.web&gt;
  &lt;compilation debug="true" targetFramework="4.0" /&gt;
  &lt;httpRuntime maxRequestLength="500000000" executionTimeout="360"/&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
  &lt;httpErrors errorMode="Detailed" /&gt;
  &lt;asp scriptErrorSentToBrowser="true" /&gt;
  &lt;/system.webServer&gt;  
  &lt;system.serviceModel&gt;    
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior&gt;          
        &lt;serviceAuthorization serviceAuthorizationManagerType="ServiceApp.APIKeyAuthorization, ServiceApp" /&gt;
        &lt;serviceMetadata httpGetEnabled="true" /&gt;
        &lt;dataContractSerializer maxItemsInObjectGraph="2147483647" /&gt;
        &lt;serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;standardEndpoints&gt;
    &lt;webHttpEndpoint&gt;
      &lt;standardEndpoint
        automaticFormatSelectionEnabled="true"
        helpEnabled="true" /&gt;
    &lt;/webHttpEndpoint&gt;
  &lt;/standardEndpoints&gt;
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false"/&gt;
  &lt;/system.serviceModel&gt;
  &lt;system.webServer&gt;
  &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
  &lt;/system.webServer&gt;
  </code></pre>