2011-10-07 96 views
1

格式化程序在尝试反序列化消息时引发异常:尝试反序列化参数http://tempuri.org/:Result时发生错误。 InnerException消息是'反序列化ServiceApplication.WebResult类型的对象时发生错误。最大字符串内容 服务器的Web.Config:协议异常未处理wcf

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" 
     propagateActivity="true"> 
     <listeners> 
      <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
      <filter type="" /> 
      </add> 
     </listeners> 
     </source> 
    </sources> 
    <sharedListeners> 
     <add initializeData="F:\WCFLoadBalance\ClientApplication\ServiceApplication\bin\web_tracelog.svclog" 
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
     name="ServiceListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack"> 
     <filter type="" /> 
     </add> 
    </sharedListeners> 
    </system.diagnostics> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </assemblies> 
    </compilation> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="ServiceBinding" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="16" maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" maxBytesPerRead="2000000" maxNameTableCharCount="2147483647" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="ServiceApplication.Service1" /> 
    </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> 
    <connectionStrings> 
    <add name="CrystalEntities" connectionString="metadata=res://*/CrystalModel.csdl|res://*/CrystalModel.ssdl|res://*/CrystalModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=FLEMIN\SQLEXPRESS;Initial Catalog=MyCrystal;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
</configuration> 

**Client App.config..** 
<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00" 
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
        maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
        maxReceivedMessageSize="2147483647" messageEncoding="Text" 
        textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
        <readerQuotas maxDepth="16" 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://localhost:54958/Service1.svc" binding="basicHttpBinding" 
       bindingConfiguration="BasicHttpBinding_IService1" contract="ClientServiceReference.IService1" 
       name="BasicHttpBinding_IService1" /> 
     </client> 
    </system.serviceModel> 
</configuration> 
+0

而你的问题是? – mellamokb

+0

我认为他/她想知道如何解决该异常 –

+0

是的感谢您的回复,我需要该解决方案,例外.. – venkat

回答

2

那你的客户端配置文件?

尝试反序列化参数http://tempuri.org/:Result时发生错误。

由于反序列化结果时发生错误,可能是在客户端。

尝试增加客户端配置文件中maxStringContentLength属性的值。或者至少发布您的客户端配置文件。