I am trying to figure this out. I was not getting any useful error messages with my code so I used something else to generate something. I have attached that code after the
check ur WebApiConfig and add this
GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();