ASP.NET Web API 2, I am able to get JSON result on local machine but when I upload same project on server it returns only XML result. Please suggest any solution for this.
Asked
Active
Viewed 32 times
-1
-
How does your client request the result? Do you set the correct content-type and accept header? – Mithrandir Feb 29 '16 at 11:18
-
I have write config.Formatters.JsonFormatter.SupportedMediaTypes.Add( new MediaTypeWithQualityHeaderValue("text/html") ); in WebApiConfig.cs – Sukhvir Singh Feb 29 '16 at 11:25
-
check this [SO link](http://stackoverflow.com/questions/9847564/how-do-i-get-asp-net-web-api-to-return-json-instead-of-xml-using-chrome) – Pavan Teja Feb 29 '16 at 11:27
-
I have already use this, but its not work for me – Sukhvir Singh Feb 29 '16 at 11:29
-
In chrome, it shows XML result and In Internet Explorer, it shows 500 Internal Server Error – Sukhvir Singh Feb 29 '16 at 11:31