Silverlight 4.0 GZIP流中的错误CRC32

Silverlight 4.0 GZIP流中的错误CRC32,silverlight-4.0,devforce,Silverlight 4.0,Devforce,我正在使用DevForce 2010和Silverlight 4 保存包含大量二进制数据的实体时,出现以下错误: Unhandled Error in Silverlight Application The remote server returned an error: NotFound. 调试应用程序时,我看到以下错误: Unhandled Error in Silverlight Application Insufficient memory to continue the execut

我正在使用DevForce 2010和Silverlight 4

保存包含大量二进制数据的实体时,出现以下错误:

Unhandled Error in Silverlight Application The remote server returned an error: NotFound.
调试应用程序时,我看到以下错误:

Unhandled Error in Silverlight Application Insufficient memory to continue the execution of the program.

Bad CRC32 in GZIP stream.
我在Ideablades论坛上找到了这个讨论这个问题的帖子:

这是服务器或客户端上的问题吗

这是一个在DevForce 2010的任何新版本中都已解决的问题吗

我的服务器有4GB内存。增加内存可以解决问题吗


或者什么是正确的解决方案?

自DevForce 2010的6.1.7版本以来,GZIP处理没有任何变化。该线程仍然包含如何解决问题的最佳信息:1)修改保存逻辑或实体定义以减少保存的数据量;2) 关闭GZIP的使用;或者3)使用另一个压缩库编写自定义消息编码器。

谢谢Kim Johnson

我已经看过了这些示例,我觉得添加这些配置文件很不舒服,可能会破坏一些今天可以正常工作的东西

如果我按照代码的方式,我是否能够关闭GZIP,并且仍然保留DevForce的其余默认设置

我想下面的代码是我应该去的

如果我在客户机和服务器上保存这些类,DevForce会自动找到这些类吗

//Client

using System.ServiceModel.Channels;
using IdeaBlade.Core.Wcf.Extensions;

public class ProxyEvents  : IdeaBlade.EntityModel.ServiceProxyEvents {

  public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint endpoint) {
    base.OnEndpointCreated(endpoint);
    // My client code turning GZIP off comes here?
  }
  public override void OnFactoryCreated(System.ServiceModel.ChannelFactory factory) {
    base.OnFactoryCreated(factory);
  }
}

//Server
using System.ServiceModel.Channels;
using IdeaBlade.Core.Wcf.Extensions;

public class ServiceEvents : IdeaBlade.EntityModel.Server.ServiceHostEvents {

  public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint endpoint) {
    base.OnEndpointCreated(endpoint);
    // My server code turning GZIP off comes here?
  }
  public override void OnServiceHostCreated(System.ServiceModel.ServiceHost host) {
    base.OnServiceHostCreated(host);
  }
}

是的,在客户端和服务器上创建的OnEndPoint覆盖是您应该添加自定义项的位置。可以添加以下内容以从绑定中删除GZIP:

public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint endpoint)
{
    if (endpoint.Binding is CustomBinding)
    {
        var binding = endpoint.Binding as CustomBinding;
        var elements = binding.CreateBindingElements();

        // Swap out existing (GZIP) message encoding for binary
        var encoding = elements.Find<MessageEncodingBindingElement>();
        if (encoding != null)
        {
            elements.Remove(encoding);

            encoding = new BinaryMessageEncodingBindingElement();
            elements.Insert(0, encoding);
            endpoint.Binding = new CustomBinding(elements);
        }
    }
}
public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint)
{
if(endpoint.Binding是CustomBinding)
{
var binding=endpoint.binding为CustomBinding;
var elements=binding.CreateBindingElements();
//将现有(GZIP)消息编码替换为二进制
var encoding=elements.Find();
if(编码!=null)
{
元素。删除(编码);
encoding=新的BinaryMessageEncodingBindingElement();
元素。插入(0,编码);
endpoint.Binding=新的CustomBinding(元素);
}
}
}
如果类位于客户端/服务器上探测的程序集中,DevForce将找到这些类


这将关闭从DevForce客户端到EntityServer的所有压缩,因此可能会有点笨手笨脚。您可以打开以压缩发送到客户端的数据以提供帮助

只是想澄清一下:当我保存实体时,客户机GZIP保存数据并将其发送到服务器。服务器试图解压缩数据,结果导致OOM问题。一个可能的解决方案就是在客户端上打开GZIP?我该怎么做?增加内存不会有帮助吗?第二个问题:如果我使用InvokeServerMethodAsync向服务器发送数据,这也会经过GZIP过程吗?DevForce使用自定义WCF消息编码器为所有进出服务器的消息提供压缩。这意味着,如果不在服务器上关闭GZIP,就无法在客户端上关闭GZIP,并且与InvokeServerMethod相关的消息也会被GZIP。如果关闭GZIP(通过更改CustomBinding),您仍然可以使用IIS压缩来压缩发送给客户端的消息。我搜索了我的解决方案,但找不到CustomBinding的任何引用。我使用的是DevForce的默认设置。我应该将这个CustomBinding添加到我的web.config吗?如果你不熟悉WCF,这会有点棘手。您可以在客户端和服务器上的.config文件中更改绑定,也可以在客户端和服务器上的代码中更改绑定。看看DevForce资源中心的一些示例,了解其中所涉及的内容。一旦您决定使用.config或代码,我可以进一步提供帮助。谢谢,我将尝试这个。我想我在某个地方读到,这个bug在iDeaBrade是“开放的”。是否有计划纠正此问题以及何时发布错误修复?抱歉,没有计划解决此问题。我们可能会更改使用的压缩库,但它不一定能解决此问题。还有一个问题:):这也是DevForce 2012中的一个问题吗?是的。DF2012还为CustomBinding使用相同的GZIP编码器。