Thursday, September 1, 2016

WCF web service content type error

After adding a new wcf service to my MVC application, when I tried to post a request, the application responded with error:

POST http://localhost:63342/ISAPI/Service1.svc/MyMethod 415 (Cannot process the message because the content type 'application/json' was not the expected type 'text/xml; charset=utf-8'.)

It can be resolved by adding Factory="System.ServiceModel.Activation.WebServiceHostFactory" to the .svc file markup like so:

<%@ ServiceHost Language="C#" Debug="true" Service="MyWebsite.ISAPI.Service1" CodeBehind="Service1.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...