Saturn K
Saturn K

Reputation: 2785

Fiddler request to WCF is failing with 504 ReadResponse() failed: The server did not return a response for this request

Relevant Service Code:

[WebGet(BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate="products")]
public Product[] GetAllProduct()
{
    return ProductProvider.Instance.GetAllProducts();
}

[OperationContract]
Product[] GetAllProduct();

Relevant Configuration Code:

<?xml version="1.0"?>
<configuration>
<connectionStrings>
    <add name="TestEntities" connectionString="metadata=res://*/ProductEntityDataModel.csdl|res://*/ProductEntityDataModel.ssdl|res://*/ProductEntityDataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=PC\MSSQL2008;initial catalog=Test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
    <services>
        <service name="Service.Default">
            <endpoint address="http://localhost:1651/Default.svc" binding="webHttpBinding" contract="Service.IDefault"/>
        </service>
    </services>
    <behaviors>
        <endpointBehaviors>
            <behavior>
                <webHttp/>
            </behavior>
        </endpointBehaviors>
    </behaviors>
</system.serviceModel>
<system.web>
    <compilation debug="true"/>
</system.web>
</configuration>

Relevant Fiddler Request

Fiddler Request

Upvotes: 2

Views: 7952

Answers (6)

tre
tre

Reputation: 19

I was getting this problem when returned dateTime object was null. It runs fine while debugging and gives problems while desalinizing. One way is to make your dateTime null able DateTime? and it will be deserialized correctly.

Hope helpful for someone.

Upvotes: 0

Jeff Ogata
Jeff Ogata

Reputation: 57783

I just ran into this and the problem was the object graph limit mentioned in the link that user72213 posted.

Modifying this limit using the ServiceBehaviorAttribute.MaxItemsInObjectGraph property did the trick for me.

You can also try the <dataContractSerializer>'s maxItemsInObjectGraph attribute, but using the attribute was more convenient in my case.

Upvotes: 0

Chris R. Donnelly
Chris R. Donnelly

Reputation: 3135

I had a similar problem with Fiddler (v2.3.9.3) with a service using a BasicHttpBinding; I was able to fix it by changing the transferMode on the binding to Streamed (the default is Buffered), and then put Fiddler in Streaming Mode (make sure the "Stream" button on the toolbar is in the selected/pressed state).

# Chris

Upvotes: 0

fiberOptics
fiberOptics

Reputation: 7165

we have same problem. I found something relevant answer here:

WCF DataContractSerializer has a limit of 65536 object in the object graph

Hope it would help.

Upvotes: 0

Hovhannes Hakobyan
Hovhannes Hakobyan

Reputation: 1326

This may because of a DateTime type property in your class which is DateTime.MinValue (0001-01-01) by default.

I had exactly the same problem and resolved it by setting the date to a bigger value.

Also you should pay attention to any property which can not directly be serialized to JSON, such as TimeSpan, DateTimeOffset etc.

Upvotes: 0

Joe
Joe

Reputation: 82554

I've had issues with URITemplate in the past. Can you try:

[WebGet(BodyStyle=WebMessageBodyStyle.WrappedResponse, ResponseFormat=WebMessageFormat.Json)]
public Product[] products()
{
    return ProductProvider.Instance.GetAllProducts();
}

[OperationContract]
Product[] products();

Upvotes: 2

Related Questions