2012-06-04 69 views
0

我建立InfoPath表单(InfoPath中2010)和自定义代码我打电话WCF服务编程为如下提交行动的一部分:奇怪的错误消息,从提交到的InfoPath WCF服务

DriverHours。 DriverHours allHours = new DriverHours.DriverHours(); bool spec;

XPathNavigator myNav = this.MainDataSource.CreateNavigator(); 

    string allData = myNav.OuterXml; 
    allData = allData.Replace("my:", ""); 

    result = allHours.SaveDriverHoursByString(allData); 

SaveDriverHoursByString只是需要XML数据的字符串,并将其保存到上通过WCF后端数据库。

当提交块执行,以下错误显示了在最后一行:

System.Web.Services.Protocols.SoapHeaderException 
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:Xml. The InnerException message was 'There was an error deserializing the object of type System.String. 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 208, position 21.'. Please see InnerException for more details. 
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) 
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) 
    at HrsServicetemplate.DriverHours.DriverHours.SaveDriverHoursByString(String Xml) 
    at HrsServicetemplate.FormCode.FormEvents_Submit(Object sender, SubmitEventArgs e) 
    at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnSubmit(DocReturnEvent pEvent) 
    at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSubmitRequest(DocReturnEvent pEvent) 

现在我意识到,解决的办法是增加对WCF服务的web.config中的内容长度。下面是我的web.config文件现在,错误仍然发生:

<?xml version="1.0"?> 
<configuration> 
    <connectionStrings> 
    <!--<add name="IFMS_Connection" connectionString="Data Source=aaaa;User Id=aaaa;Password=abcdefg;"/> --> 
    <add name="IFMS_Connection" connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=aaaa)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME = ORCLDEVL)));User Id=aaa;Password=aaaa;"/> 

    </connectionStrings> 
    <system.web> 
    <httpRuntime maxRequestLength="2147483647" /> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 

    <bindings> 
     <wsHttpBinding> 

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

      <security mode="None"> 
      <transport clientCredentialType="None"/> 
      <message establishSecurityContext="false"/> 
      </security> 


     </binding> 
     </wsHttpBinding> 



    </bindings> 


    <services> 

    </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" />   
     </behavior> 
     <behavior name="metadataAndDebug"> 
      <serviceMetadata httpGetEnabled="true" /> 

      <serviceDebug 
      includeExceptionDetailInFaults="true"/> 

     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

任何想法?特别是我想知道丢失配置条目,谢谢!

回答

0

这可能是因为您已经更新了服务器端的配置,但没有更新客户端的配置。