Hi friends,
public interface IDriverService
{
[OperationContract]
[WebInvoke(UriTemplate = "GetData", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
List<Availability> GetData(GetDriverRequest GetDriverRequest);
}
<service behaviorConfiguration="debug" name="CloudServices.DriverService">
<endpoint address="json" binding="webHttpBinding" bindingConfiguration="webHttpBindingSettings" behaviorConfiguration="RestJSONEndpointBehavior" contract="CloudServices.IDriverService" />
</service>
<webHttpBinding>
<binding name="webHttpBindingSettings" openTimeout="10:00:00"
receiveTimeout="10:00:00" sendTimeout="10:00:00" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</webHttpBinding>
<endpointBehaviors>
<behavior name="RestJSONEndpointBehavior">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
</behavior>
</endpointBehaviors>
My request should be like this
http:
Content-type:application/json
{"City":"Vijayawada","GetAction":"Driversavailabledays"}
Response:
[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
What I have tried:
I worked on wcf services with xml response. it's working fine. Now i need to change xml to json response for wcf service. I changed the web.config settings and request and response formats for json in Interface.
the below listed code is working fine for xml but not for Json.
Please help me to fix this issue
Thanks