2014-11-03 3 views
0

У меня есть приложение Silverlight 5, развернутое в IIS 7, с использованием расширений источника данных для подключения к нескольким базам данных. Мы испытывали на «Bad CRC32 в GZIP потоке» за исключением, поэтому мы решили прислушаться к советам, чтобы заменить GZIP связывание с двоичным сообщением связывания и использовать сжатие IIS, которое дано здесь: Bad CRC32 in GZIP streamОтключение GZIP в конфигурации DevForce

Но я должен что-то не хватает в моем web.config. Когда я заменил узел gzipMessageEncoding с binaryMessageEncoding, я начал получать:

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

, когда мое приложение пытается связаться с EntityService.svc/сл.

Вот мой web.config, который я основывал на образце web.config от Файлы, относящиеся к IIS, по адресу http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-configuration-files.

<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

Данные привязки WCF должны быть одинаковыми как на клиенте, так и на сервере, поэтому вам также необходимо добавить или изменить информацию ServiceReferences.ClientConfig на клиенте Silverlight. Есть образец в http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-custom-client-servicemodel.

+0

Я никогда не мог понять, как правильно установить ServiceReferences.ClientConfig, поэтому я закончил внедрение ServiceProxyEvents и переопределив OnEndpointCreated. – Mitchell

Смежные вопросы