1

我正在使用 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 论坛上找到了讨论该问题的主题:http ://www.ideablade.com/forum/forum_posts.asp?TID=3361&PN=1&title=bad-crc32-in-gzip-stream

这是服务器还是客户端的问题?

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

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

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

4

3 回答 3

1

是的,客户端和服务器上的 OnEndpointCreated 覆盖是您应该添加自定义的地方。您可以添加以下内容以从绑定中删除 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);
        }
    }
}

如果您的类位于客户端/服务器上探测的程序集中,DevForce 将找到它们。

这将关闭从 DevForce 客户端到 EntityServer 的所有内容的压缩,因此可能有点笨拙。您可以打开IIS 压缩以帮助压缩发送到客户端的数据。

于 2014-05-28T17:15:01.063 回答
0

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

于 2014-05-26T23:21:30.553 回答
0

谢谢金约翰逊,

我查看了示例,我觉得添加这些配置文件并可能破坏今天运行良好的东西感到不舒服。

如果我采用代码方式,我是否能够关闭 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);
  }
}
于 2014-05-28T12:12:31.420 回答