我有一个WCF服务,被Delphi应用程序调用。有时候,当向服务器发送大量请求时,会出现以下错误:
---------------------------
Debugger Exception Notification
---------------------------
Project Project43.exe raised exception class ERemotableException with message 'The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'Log'. 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 58, position 140.'.
---------------------------
Break Continue Help
---------------------------
我已经按照以下方式在服务器端配置了web.config:
Web.config
<?xml version="1.0" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding">
<readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="NewServiceType">
<clear />
<endpoint address="http://localhost" binding="basicHttpBinding" bindingConfiguration="" contract="IRoboConsultaLog" />
</service>
</services>
<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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
但是我一直收到这个错误。有些网友建议在客户端的app.config文件也要进行修改,但是我不知道该怎么做,因为我在使用Delphi。
我还注意到我不知道如何正确配置
<endpoint>
标签,也许这就是所有问题的原因。以下是我的Web服务接口和类(为了更清晰而缩减):namespace RoboConsultaLogServer
{
[ServiceContract]
public interface IRoboConsultaLog
{
[OperationContract]
void Log(string key, string numeroSerial, string nomeTarefa, int qtdProcessos, float uptime, float duracaoTarefa,
int qtdSucesso, int qtdInsucesso, int qtdCancelado, bool servico, bool notificarResponsaveis, string logProcessos);
}
}
类
public class RoboConsultaLog : IRoboConsultaLog
{
...
}
有人知道如何修复这个问题吗?