Q: Fail to Post to WCF Rest Service over HTTPS 400 bad request Issue : When Posting to WCF rest service over https client receives 400 bad request.
This all works in a test environment with no issues.  The test web get works over https but the post method fails with a 400 bad request.
The only difference between test and prod is the web config were I had to add the behaviors and bindings to get just the test webget method working.  But I can't figure out what is causing a post to fail.
I have also tried adding specific endpoints and services initially and found a better solution for using standard endpoints.  So i removed the endpoints and services because that should all be registered through the global.asax file correct.
Any help, suggestions, or see the obvious that I am sure I over looked 100 times now.
Service Code:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Uploader
 {
    [WebGet(UriTemplate = "Test")]
    public String Test()
    {
        return "connected";
    }

    [OperationContract]
    [WebInvoke(UriTemplate = "UploadClaim/{fileName}/{device_id}/{fSize}", Method = "POST")]
    public String UploadClaim(string fileName, string device_id, string fSize, Stream zipFile)
    {
       // Handle post request and store file
    }

}

Global.asax:
void Application_Start(object sender, EventArgs e)
{
    RouteTable.Routes.Add(new ServiceRoute("uploads", new WebServiceHostFactory(), typeof(Uploader)));

}

Web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceAuthorization principalPermissionMode="None"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <webHttpBinding>
    <binding>
      <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" />
        </security>
    </binding>
    <binding name="UnsecureBinding"></binding>
  </webHttpBinding>
</bindings>
<protocolMapping>
  <add scheme="http" binding="webHttpBinding" bindingConfiguration="UnsecureBinding" />
  <add scheme="https" binding="webHttpBinding" bindingConfiguration="UnsecureBinding" />
</protocolMapping>
<standardEndpoints>
  <webHttpEndpoint>
    <!-- 
        Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
        via the attributes on the <standardEndpoint> element below
    -->
    <standardEndpoint name="" helpEnabled="true" defaultOutgoingResponseFormat="Json" maxReceivedMessageSize="67108864" 
    transferMode="Buffered">
    <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" />
        </security>
    </standardEndpoint>

  </webHttpEndpoint>
</standardEndpoints>


</system.serviceModel>

Client Request:
  // This url is not the actual but not the problem.  
  //  The only difference from test to  prod is http vs https
requestUrl = "https://MyDomain.com/uploads/UploadClaim/{FILENAME}/{DEVICE_ID}/{FSIZE}";



            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUrl);

            request.Method = "POST";

            request.ContentType = "application/octet-stream";

            request.Timeout = 1000000;

            request.KeepAlive = true;

            request.AllowWriteStreamBuffering = true;

            //request.SendChunked = true;

            //request.ContentType = "application/octet-stream";

            //FileStream inputStream = File.OpenRead(strfPath);

            //request.ContentLength = inputStream.Length;



            byte[] fileToSend = File.ReadAllBytes(strfPath);

            request.ContentLength = fileToSend.Length;



            //Byte[] buffer = new Byte[inputStream.Length];

            ///Stream requestStream = request.GetRequestStream();

            using(Stream requestStream = request.GetRequestStream()){

                bool canWrite = requestStream.CanWrite;

                // Send the file as body request.

                requestStream.Write(fileToSend, 0, fileToSend.Length);



                requestStream.Flush();

                requestStream.Close();

            }


A: Wow, So captain obvious finally showed up.
Thanks to Aaron Hoffman's answer in this post : Large WCF web service request failing with (400) HTTP Bad Request
Adding the below diagnostics help me identify that the IIS_USER account did not have write permissions to the directory I was trying to write too.  Even though the directory is in site directory.  Added permissions to IIS_USER to write to folder and no more issues.
Hope this may help someone else overlooking the obvious like me :)
<system.diagnostics>
<sources>
    <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
            <add name="traceListener"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData= "c:\log\Traces.svclog" />
        </listeners>
    </source>
</sources>


