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:
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:
Post a Comment