Отправка странного сообщения об ошибке из InfoPath в службу WCF

Я создаю форму InfoPath (InfoPath 2010) и в пользовательском коде программно вызываю службу WCF как часть действия отправки, как показано ниже:

DriverHours.DriverHours allHours = new DriverHours.DriverHours(); логическое значение;

    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)

Теперь я знаю, что решение состоит в том, чтобы увеличить длину содержимого в файле web.config службы WCF. Ниже приведен мой файл 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>

Любые идеи? В частности, меня интересуют отсутствующие записи конфигурации, спасибо!


person tekiegreg    schedule 04.06.2012    source источник


Ответы (1)


Возможно, вы обновили конфигурацию на стороне сервера, но не конфигурацию клиента.

person Shiraz Bhaiji    schedule 04.06.2012