【问题标题】:Turning off GZIP in DevForce Config在 DevForce Config 中关闭 GZIP
【发布时间】:2014-11-03 18:13:29
【问题描述】:

我有一个 Silverlight 5 应用程序部署在 IIS 7 中,使用数据源扩展连接到多个数据库。我们一直在经历“GZIP 流中的错误 CRC32”异常,因此我们决定听取建议,将 GZIP 绑定替换为二进制消息绑定并使用 IIS 压缩,这里给出了: Bad CRC32 in GZIP stream

但我的 web.config 中一定遗漏了一些东西。当我用 binaryMessageEncoding 替换 gzipMessageEncoding 节点时,我开始得到:

Cannot process the message because the content type 'application/x-gzip' was not the expected type 'application/soap+msbin1'.

当我的应用程序尝试与 EntityService.svc/sl 通信时。

这是我的 web.config,它基于 http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-configuration-filesIIS 相关文件 中的示例 web.config。

  <ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">
    <logging logFile="log/sl.xml" archiveLogs="true" />
    <objectServer>
      <serverSettings supportedClientApplicationType="Silverlight"/>
    </objectServer>
  </ideablade.configuration>

  <system.serviceModel>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />

    <services>
      <service name="EntityService">
        <endpoint address="sl" binding="customBinding" bindingConfiguration="customBinaryBindingHttp" contract="IdeaBlade.EntityModel.Server.IEntityServiceContract" />
      </service>
      <service name="IdeaBlade.EntityModel.Server.EntityServer">
        <endpoint address="sl" binding="customBinding" bindingConfiguration="customBinaryBindingHttp" contract="IdeaBlade.EntityModel.Server.IEntityServerContract" />
      </service>
    </services>

    <bindings>
      <customBinding>
        <binding name="customBinaryBindingHttp" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" >
          <binaryMessageEncoding>
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
          </binaryMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>

  <system.web>
    <httpRuntime maxRequestLength="1048576" executionTimeout="1200" targetFramework="4.5.1" />
    <compilation debug="false" targetFramework="4.5.1" />
    <customErrors mode="RemoteOnly" defaultRedirect="error.htm" />
  </system.web>

  <connectionStrings>
    <add name="MyEntities_1234" connectionString="XXX" providerName="System.Data.EntityClient" />
    <add name="MyEntities_5678" connectionString="XXX" providerName="System.Data.EntityClient" />
  </connectionStrings>

  <system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="default.aspx" />
        <add value="index.html" />
        <add value="Default.htm" />
        <add value="Default.asp" />
        <add value="index.htm" />
        <add value="iisstart.htm" />
      </files>
    </defaultDocument>
    <modules>
      <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="managedHandler" />
    </modules>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>

</configuration>

我做错了什么?

【问题讨论】:

    标签: silverlight devforce


    【解决方案1】:

    客户端和服务器端的 WCF 绑定信息需要相同,因此您还需要在 Silverlight 客户端上添加或更改 ServiceReferences.ClientConfig 信息。 http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-custom-client-servicemodel 有一个示例。

    【讨论】:

    • 我一直无法弄清楚如何正确设置 ServiceReferences.ClientConfig,所以我最终实现了 ServiceProxyEvents 并覆盖了 OnEndpointCreated。
    猜你喜欢
    • 2011-03-19
    • 1970-01-01
    • 2016-12-03
    • 2022-01-19
    • 2022-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多