Wcf 读取XML数据时已超过最大字符串内容长度配额(8192)

Wcf 读取XML数据时已超过最大字符串内容长度配额(8192),wcf,Wcf,我试图调用读取XML字符串的WCF服务。我得到这个错误 “格式化程序错误设置了最大字符串内容长度配额 (8192)在读取XML数据时被超过。”下面是服务web.config文件 <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system

我试图调用读取XML字符串的WCF服务。我得到这个错误 “格式化程序错误设置了最大字符串内容长度配额 (8192)在读取XML数据时被超过。”下面是服务web.config文件

<?xml version="1.0"?>
<configuration>

<system.web>
    <compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug     includeExceptionDetailInFaults="true"/>
                <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IOrderCreateService"
                     maxReceivedMessageSize="2147483647"
                     openTimeout="00:1:00"
                     closeTimeout="00:1:00"
                     sendTimeout="00:25:00"
                     receiveTimeout="00:25:00">

            </binding>

        <binding name="HandleLargeMessage" maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="2147483647"
               maxStringContentLength="2147483647"
               maxArrayLength="2147483647"
               maxBytesPerRead="2147483647"
               maxNameTableCharCount="2147483647" />

        </binding>
        </basicHttpBinding>

    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>

        <!-- beta.telagententerprise.com/WcfServices-->
        <service name="OrderCreateService.OrderCreateService">
            <endpoint name="MessageServiceEndpoint"
                      address="http://localhost:2966/OrderCreateService.svc"
                      binding="basicHttpBinding"
                      bindingConfiguration="HandleLargeMessage"
                      contract="IOrderCreateService" />

        </service>

    </services>     
</system.serviceModel>

下面是客户端app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <behaviors>
    <serviceBehaviors>
        <behavior>
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="true"/>
            <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
    </serviceBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IOrderCreateService"
                     maxReceivedMessageSize="2147483647"
                     openTimeout="00:1:00"
                     closeTimeout="00:1:00"
                     sendTimeout="00:25:00"
                     receiveTimeout="00:25:00">

            </binding>

            <binding name="HandleLargeMessage" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647"
                   maxStringContentLength="2147483647"
                   maxArrayLength="2147483647"
                   maxBytesPerRead="2147483647"
                   maxNameTableCharCount="2147483647" />

            </binding>
        </basicHttpBinding>

    </bindings>
    <client>
        <endpoint name="MessageServiceEndpoint"
                      address="http://localhost:2966/OrderCreateService.svc"
                      binding="basicHttpBinding"
                      bindingConfiguration="HandleLargeMessage"
                      contract="OrderCreateService.IOrderCreateService" />


    </client>
</system.serviceModel>

我搜索了这个错误,尝试了上面的代码,仍然得到了8192错误。 任何帮助都会很好。 谢谢 服务器端配置-->端点元素合约值未完全限定。应该是
OrderCreateService.IOrderCreateService


此外,如果您在IIS上托管,则到服务的地址映射由IIS处理。

即使在客户端和服务器.config文件上设置了maxStringContentLength=“2147483647”,我也遇到了同样的问题。在web上尝试了许多建议后,通过在客户端和服务器项目上匹配目标框架(在Visual Studio 2013中的项目属性/构建选项卡/平台目标下)解决了此问题。

您能显示客户端代码吗?