开发者

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.Wrap开发者_JAVA技巧pedResponse, 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 to WCF is failing with 504 ReadResponse() failed: The server did not return a response for this request


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();


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.


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.


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜