我在IIS 7中部署了Silverlight 5应用程序,使用数据源扩展连接到多个数据库。我们一直在遇到“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-files上 IIS相关文件中的示例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>
我做错了什么?
答案 0 :(得分:0)
客户端和服务器上的WCF绑定信息必须相同,因此您还需要在Silverlight客户端上添加或更改ServiceReferences.ClientConfig信息。在http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-custom-client-servicemodel处有一个示例。