开发者

WCF Service Problem Only in Production when return larger objects

First, here's my service contract:

[ServiceContract]
public interface IUpdateService
{
    [O开发者_如何学GoperationContract]
    IEnumerable<SoftwareUpdate> GetUpdates(string version);

    [OperationContract]
    bool AreUpdatesAvailable(string version);
}

And here's SoftwareUpdate:

[DataContract]
public class SoftwareUpdate
{
    [DataMember]
    public Version Version { get; set; }

    [DataMember]
    public byte[] UpdateArchive { get; set; }
}

The problem I am having is that, in production, as the UpdateArchive property begins to contain more data.


Your issue is likely with your send / receive size as well as the objects in Graph issue that JDB posted above. You can inflate these numbers in your configuration to a point where it will work for the moment with the amount of data you currently have, however, this is not a viable long term solution when you might end up passing very large responses back and forth.

I would recommended looking into streaming your serialized response from the WCF service, which will allow you a limitless amount of data longer term to be sent and received. This process is outlined in this MSDN link: http://msdn.microsoft.com/en-us/library/ms733742.aspx

Don't let the length of the article scare you, it's just giving you background information on why and how. The process itself isn't too complicated to understand and will solve your problem going into the future.

~VulgarBinary


Try throwing this in the web.config

<serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
            <dataContractSerializer maxItemsInObjectGraph="900000"/>
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
</serviceBehaviors>


Thanks for the advice. I'm new to WCF, so I certainly appreciate it. Before reading your responses, I turned on tracing and found that it was actually a permissions problem with my files that I was working with. The fact that I had these problems at the time I was using a larger file was a coincidence.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜