在IIS问题上托管WCF工作流

时间:2012-07-04 13:53:35

标签: wcf iis

我在IIS上托管了WCF WF。从客户端我试图访问IIS上的服务,但得到这样的错误:

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'GetData'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 197, position 41.

这是我的web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="DataAccess.SharePoint.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <applicationSettings>
    <DataAccess.SharePoint.Properties.Settings>
      <setting name="DataAccess_SharePoint_Officecms_Lists" serializeAs="String">
        <value>http://site/_vti_bin/lists.asmx</value>
      </setting>
    </DataAccess.SharePoint.Properties.Settings>
  </applicationSettings>
</configuration>

这是我的客户端app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
                    openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                    maxReceivedMessageSize="2147483647" messageEncoding="Text"
                    textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" 
                                  />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://server2008/Services/Search.xamlx"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                contract="SearchService.IService" name="BasicHttpBinding_IService" />
        </client>
    </system.serviceModel>
</configuration>

你可以验证我的配置,修改并解释我做错了吗?

1 个答案:

答案 0 :(得分:0)

您是在服务器上还是在客户端上收到此消息?如果从客户端到服务器的消息大于默认限制,则需要在web.config中增加该消息。

您可以通过将其添加到system.ServiceModel部分来控制web.config中的绑定:

  <bindings>
      <basicHttpBinding>
        <binding>
          <readerQuotas maxStringContentLength ="<your max here>"/>
        </binding>
      </basicHttpBinding>
    </bindings>
相关问题