title: "Message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported
body: <p>I am not sure what i am missing. This code works perfectly fine on my local development machine and when I have deployed this on to a testing server it keeps throwing internal server error or "Message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource.</p>
  
  <p>Am I doing everything correctly here? I am just insert simple student data. Here one webapi function insert data collected from two objects(Student and StudentAddress). So I am storing these two objects into model and then consuming them in WebAPI. </p>
  
  <p>I am still wondering how its working in my local machine. I have deployed all the files to testing server.</p>
  
  <p><strong>Student Model</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace WebAPI.Models
  {
      public class StudentModel
      {
          public Student Student { get; set; }
          public StudentAddress StudentAddress { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>Student Controller</strong></p>
  
  <pre><code>// POST: api/Student/InsertStudent
  [ResponseType(typeof(StudentModel))]
  [HttpPost]
  public HttpResponseMessage InsertStudent(StudentModel studentModel)
  {
      objCSADBEntities.Student.Add(studentModel.Student);
      objCSADBEntities.SaveChanges();
  
      objCSADBEntities.StudentAddress.Add(studentModel.StudentAddress);
      objCSADBEntities.SaveChanges();
  
      return Request.CreateResponse(HttpStatusCode.OK, studentModel);
  }
  </code></pre>
  
  <p><strong>On Submit button click calling Angularjs submit function which has this code</strong></p>
  
  <pre><code>        var Student = {
                  Name: $('#txt-FacilityLegalName').val().trim(),
                  LastDate: '2016-12-09 05:24:55.407',
                  SSMA_TimeStamp: '0x000000000778FCB1',
              };
  
              var StudentAddress = {
                  AddressLine1: $('#txt-MailingAddressLine1').val().trim(),
                  AddressLine2: ($('#txt-MailingAddressLine2').val().trim() != '' ? $('#txt-MailingAddressLine2').val().trim() : null),
                  City: $('#txt-City').val(),
                  State: $scope.objselectedstate.selectedstate.Value,
                  ZipCode: $('#txt-ZipCode').val().trim(),
                  ZipExt: ($('#txt-ZipExt').val().trim() != '' ? $('#txt-ZipExt').val().trim() : null),
                  FullName: $('#txt-ContactFirstName').val().trim() + ' ' + $('#txt-ContactLastName').val().trim(),
                  FirstName: $('#txt-ContactFirstName').val().trim(),
                  LastName: $('#txt-ContactLastName').val().trim(),
                  PhoneNumber: $('#txt-ContactPhone').val().trim(),
                  Ext: ($('#txt-ContactPhoneExt').val().trim() != '' ? $('#txt-ContactPhoneExt').val().trim() : null),
                  Fax: ($('#txt-ContactFax').val().trim() != '' ? $('#txt-ContactFax').val().trim() : null),
                  Email: $('#txt-Email').val().trim()
              };
              var studentModelModel = { studentAddress: StudentAddress, student: Student };
              //Insert Student
              var insertStudent = providerService.insertStudent($scope.webAPIHostName, studentModelModel);
              insertStudent.then(function (response) {
                  //success response here
              }, function (error) {
                  // error handling here
              });
  </code></pre>
  
  <p><strong>Angularjs Service.js</strong></p>
  
  <pre><code>(function () {
  
      var app = angular.module('myApp');
  
      app.factory('studentService', ['$http', function ($http) {
          var factory = [];
  
          //Insert Student
          factory.insertStudent = function (webAPIHostName, studentModel) {
              var request = $http({
                  method: 'POST',
                  url: webAPIHostName + '/Provider/InsertStudent',
                  data: studentModel
              })
              return request;
          }
  
          return factory;
      }
      ]);
  })();       
  </code></pre>
  
  <p>In Console I see this Request and Response</p>
  
  <pre><code>Request URL: http://localhost:5555/webapi/api/Student/InsertStudent
  Request Method: POST
  Status Code: 415 Unsupported Media Type
  Referrer Policy: no-referrer-when-downgrade
  Cache-Control: no-cache
  Content-Length: 108
  Content-Type: application/json; charset=utf-8
  Date: Fri, 10 Jan 2020 23:50:25 GMT
  Expires: -1
  Pragma: no-cache
  X-Frame-Options: SAMEORIGIN
  X-UA-Compatible: IE=Edge
  Accept: application/json, text/plain, */*
  Accept-Encoding: gzip, deflate
  Accept-Language: en-US,en;q=0.9
  Connection: keep-alive
  Content-Length: 374
  Content-Type: application/octet-stream; charset=UTF-8
  Cookie: ASP.NET_SessionId=qaqikpomv1fuqlorb5difdxp
  </code></pre>