title: Unable to upload an image with parameters to wcf rest service
body: <p>Please dont mark it as Duplicate. I have treid many times but failed. </p>
  
  <p>i am getting stream content and saving my image with static name. But i am unable to sending the image file-name,extension parameters to that post URL.</p>
  
  <p>my code is like below</p>
  
  <p><strong>My Web.Config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.0"/&gt;
  &lt;/system.web&gt;
  &lt;system.serviceModel&gt;
      &lt;services&gt;
          &lt;service name="PracticeWcfService1.Service1" behaviorConfiguration="ServiceBehaviour"&gt;
  
              &lt;endpoint name="RestClient"
                        address="RestType"
                        binding="webHttpBinding"
                        contract="PracticeWcfService1.IService1"
                        behaviorConfiguration="PracticeWcfService1.Service1ehaviour" &gt;
                  &lt;identity&gt;
                      &lt;dns value="localhost" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;
  
              &lt;endpoint name="RestClientWithSecure"
                        address="RestTypeWithSecure"
                        binding="webHttpBinding"
                        contract="PracticeWcfService1.IService1"
                        bindingConfiguration="PracticeWcfService1.Services.ClientServicesEndpointBinding"
                        behaviorConfiguration="PracticeWcfService1.Service1ehaviour" &gt;
                  &lt;!--bindingConfiguration used to give the security mode like HTTPS--&gt;
                  &lt;!--behaviorConfiguration used to define type of endpointBehaviors--&gt;
                  &lt;identity&gt;
                      &lt;dns value="localhost" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;
  
              &lt;endpoint  name="SoapClient"
                  address="SoapType"
                  binding="basicHttpBinding"
                  contract="PracticeWcfService1.IService1"&gt;
                  &lt;identity&gt;
                      &lt;dns value="localhost" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;
  
              &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"&gt;&lt;/endpoint&gt;
  
              &lt;host&gt;
                  &lt;baseAddresses&gt;
                      &lt;add baseAddress="http://localhost:33333/Service1.svc" /&gt;
                  &lt;/baseAddresses&gt;
              &lt;/host&gt;
  
          &lt;/service&gt;
      &lt;/services&gt;
      &lt;bindings&gt;
          &lt;webHttpBinding&gt;
              &lt;binding name="PracticeWcfService1.Services.ClientServicesEndpointBinding" transferMode="Streamed" maxBufferSize="2147483647"
                       maxReceivedMessageSize="2147483647" openTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:10:00"&gt;
                  &lt;security mode="Transport"&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
          &lt;/webHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;behaviors&gt;
          &lt;endpointBehaviors&gt;
              &lt;behavior name="PracticeWcfService1.Service1ehaviour"&gt;
                  &lt;webHttp/&gt; &lt;!--helpEnabled="true" automaticFormatSelectionEnabled="true"--&gt;
              &lt;/behavior&gt;
          &lt;/endpointBehaviors&gt;
          &lt;serviceBehaviors&gt;
              &lt;behavior name="ServiceBehaviour"&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" httpsGetEnabled="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;serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances="250"/&gt;
              &lt;/behavior&gt;
  
          &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
      &lt;directoryBrowse enabled="true" /&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>In IService1 interface:</strong></p>
  
  <pre><code>[OperationContract]
          string RecieveImage(string fileName, Stream ImageStream);
  </code></pre>
  
  <p><strong>in Service1.svc.cs</strong></p>
  
  <pre><code>    [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "UploadFile/{fileName}")] 
              public string RecieveImage(string fileName, Stream ImageStream)
                  using (FileStream fs = new FileStream(@"\\192.168.1.2\Common\Pratap\" + fileName + ".jpeg", FileMode.Create))
                  {
                      ImageStream.CopyTo(fs);
                      ImageStream.Close();
                  }
              }
              catch (Exception ex)
              {
                  throw new WebFaultException&lt;string&gt;(ex.Message, System.Net.HttpStatusCode.BadRequest);
              }
              return "Successsfully recieved.";
  </code></pre>
  
  <p><strong>in Service view markup:</strong></p>
  
  <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="PracticeWcfService1.Service1" CodeBehind="Service1.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory"%&gt;
  </code></pre>
  
  <p>please clear my issue...</p>