locked
Where is the configuration file?? RRS feed

  • Question

  • Hello guys,

    I am working on a WF 4.0 declarative service with VS 2010 beta 2.

    I am getting the following error:

    The formatter threw an exception while trying to deserialize the message: 
    Error in deserializing body of request message for operation 'Process'.
    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.

    Here is the code for your reference:

    <WorkflowService mc:Ignorable="sap" ConfigurationName="Mailbox" Name="Mailbox" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:p1="http://services.ed.com/" xmlns:s="clr-namespace:System;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:s1="clr-namespace:System;assembly=mscorlib" xmlns:s2="clr-namespace:System;assembly=System" xmlns:s3="clr-namespace:System;assembly=System.Xml" xmlns:s4="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sd1="clr-namespace:System.Data;assembly=System.Data.DataSetExtensions" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
      <sap:WorkflowViewStateService.ViewState>
        <scg3:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="ShouldExpandAll">False</x:Boolean>
        </scg3:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <p:Sequence DisplayName="Mailbox Service" sad:XamlDebuggerXmlReader.FileName="C:\Workspace\ED\Applications\ED\ED.Services.Mailbox\Mailbox.xamlx" sap:VirtualizedContainerService.HintSize="299,472">
        <p:Sequence.Variables>
          <p:Variable x:TypeArguments="x:String" Name="email" />
        </p:Sequence.Variables>
        <sap:WorkflowViewStateService.ViewState>
          <scg3:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg3:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <p:Sequence DisplayName="Recieve / Send Sequence" sap:VirtualizedContainerService.HintSize="277,348">
          <p:Sequence.Variables>
            <p:Variable x:TypeArguments="CorrelationHandle" Name="handle" />
          </p:Sequence.Variables>
          <sap:WorkflowViewStateService.ViewState>
            <scg3:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            </scg3:Dictionary>
          </sap:WorkflowViewStateService.ViewState>
          <Receive x:Name="__ReferenceID0" CanCreateInstance="True" sap:VirtualizedContainerService.HintSize="255,92" OperationName="Process" ServiceContractName="p1:IMailbox">
            <Receive.CorrelatesOn>
              <MessageQuerySet />
            </Receive.CorrelatesOn>
            <Receive.CorrelationInitializers>
              <RequestReplyCorrelationInitializer CorrelationHandle="[handle]" />
            </Receive.CorrelationInitializers>
            <ReceiveMessageContent DeclaredMessageType="x:String">
              <p:OutArgument x:TypeArguments="x:String">[email]</p:OutArgument>
            </ReceiveMessageContent>
          </Receive>
          <SendReply Request="{x:Reference __ReferenceID0}" DisplayName="Send Reply" sap:VirtualizedContainerService.HintSize="255,92">
            <SendMessageContent DeclaredMessageType="x:String">
              <p:InArgument x:TypeArguments="x:String">[String.Format("I recieved {0}", email)]</p:InArgument>
            </SendMessageContent>
          </SendReply>
        </p:Sequence>
      </p:Sequence>
    </WorkflowService>


    For this reason, I was interested to tweak the service config to increase message size. But I couldn't find service definition in the provided web.config file.

    Would you be able to help me out with this one, please?

    Thank you,
    Roobii :)
    • Edited by Roobii Wednesday, December 23, 2009 6:19 PM
    Tuesday, December 22, 2009 3:58 PM

Answers

  • Hi Roobii,

    There have been a lot of comments in this thread, but the solution for your problem was simple: you needed to change the buffer size for your service, and in order to do that you need to modify some properties in the binding used in your service endpoint.

    The config template for WF services has been designed taking into account the new default configuration model developed in .NET 4, which makes the <service> section in service configuration files optional. That largely reduces the size of configuration files and thus they become easier to modify and maintain. You can find more information about this new configuration model in this link: http://msdn.microsoft.com/en-us/library/ee354381.aspx or in this blog post: http://blogs.msdn.com/endpoint/archive/2009/06/30/service-configuration-improvements-in-net-4.aspx.

    In the particular case of your service, you need to define a binding, with an empty name, that changes the size of the buffer. This configuration file should be enough for you:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
          </basicHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>
    

    and you do not need to change anything else. In this case, you will have a WF service with an HTTP endpoint using that basicHttpBinding. No need of <service> section.

    If you wanted to use wsHttpBinding instead of basicHttpBinding, then you will need to use the <protocolMapping> section to change the default mapping between HTTP address scheme and the corresponding binding, something like:

        <protocolMapping>
          <add scheme="http" binding="wsHttpBinding" />
        </protocolMapping>

    Hope this helps.

    Saturday, January 9, 2010 4:46 AM

All replies

  • I don't actually know, but check these other threads, other people seem to have solved the same problem by modifying their config file to specify a binding with increased maximum message size.

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/d114457f-b17c-4e2f-ab8a-c84d1afd9d04/
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/6ad1bf1c-e340-44ae-8ba5-91428d6e78a7/
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/9ec67e8a-283e-4a6c-8d91-f89b0bd10dca/

    Tim
    Wednesday, December 23, 2009 12:49 AM
  • I don't actually know, but check these other threads, other people seem to have solved the same problem by modifying their config file to specify a binding with increased maximum message size.

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/d114457f-b17c-4e2f-ab8a-c84d1afd9d04/
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/6ad1bf1c-e340-44ae-8ba5-91428d6e78a7/
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/9ec67e8a-283e-4a6c-8d91-f89b0bd10dca/

    Tim
    Thank you so much Tim. Really appreciate it :)

    I had actually the same problem when I had this service in WCF. And I actually solved it the same way the links above suggests that time.
    But since I moved this service to the declarative WF 4.0 service, I am no longer able to find the service definition in the web.config file.

    I wish it was as easy as WCF where we simply increase the quota in the web.config file but unfortunately, it is not! :(
    Hope this helps to better understand my problem.

    Thanks again,
    Roobii :)
    Wednesday, December 23, 2009 1:17 AM
  • Wow!! I didn't know this was such a hard question to ask!! :P

    Everyone knows how to fix it in WCF... anyone know the work around for WF... anyone???

    -- Roobii :)
    Wednesday, December 23, 2009 6:10 PM
  • Continuing, I got a little advice from some other folks. The file web.config applies for a WF declarative service project as well as WCF projects. You can edit it manually or with SvcConfigEditor, like for regular WCF projects, and configure the endpoint there.

    Quote:
    I don’t know if there are MSDN pages for it. But I did configure it before.

    1)      You can use SvcConfigEditor to open Web.config

    2)      Manually add a service contract and endpoint, with name you specified in Receive activity.

    3)      In the service endpoint, you can configure the binding.



    One more tip quoting Hong Wang:

    in the endpoint session, you should only put the local name in the contract attribute. For example if you contract name [in WF definition] is "{http://temp.org}IService1", in your config file, you should only put IService1.

    <endpoint address ="" binding="wsHttpBinding" contract="IService1">

    Following these instructions I generated something like the following as part of my web.config file

    <system.serviceModel>

        <services>

          <service name="SomeService">

            <endpoint address="http://addr" binding="wsHttpBinding" bindingConfiguration="NewBinding0"

              contract="IService1" />

          </service>

        </services>

        <bindings>

          <wsHttpBinding>

            <binding name="NewBinding0" />

          </wsHttpBinding>

        </bindings>

     

    and so I would guess you just need to add options such as

     

     

     

     

    maxBufferSize="2147483647"

     

    maxBufferPoolSize="524288"

     

    maxReceivedMessageSize="2147483647">
    to that config?

    I have no idea how to test this, so I'm going to leave this as a 'guess', not an answer, if you can get it working based on this, it would be great to have the working answer posted for posterity.
    Wednesday, December 23, 2009 7:14 PM
  • Continuing, I got a little advice from some other folks. The file web.config applies for a WF declarative service project as well as WCF projects. You can edit it manually or with SvcConfigEditor, like for regular WCF projects, and configure the endpoint there.

    Quote:
    I don’t know if there are MSDN pages for it. But I did configure it before.

    1)       You can use SvcConfigEditor to open Web.config

    2)       Manually add a service contract and endpoint, with name you specified in Receive activity.

    3)       In the service endpoint, you can configure the binding.



    One more tip quoting Hong Wang:

    in the endpoint session, you should only put the local name in the contract attribute. For example if you contract name [in WF definition] is "{http://temp.org}IService1", in your config file, you should only put IService1.

    < endpoint address = "" binding = "wsHttpBinding " contract = "IService1 ">

    Following these instructions I generated something like the following as part of my web.config file

    < system.serviceModel >

        < services >

          < service name = " SomeService " >

            < endpoint address = " http://addr " binding = " wsHttpBinding " bindingConfiguration = " NewBinding0 "

              contract = " IService1 " />

          </ service >

        </ services >

        < bindings >

          < wsHttpBinding >

            < binding name = " NewBinding0 " />

          </ wsHttpBinding >

        </ bindings >

     

    and so I would guess you just need to add options such as

     

     

     

     

     

     

    maxBufferSize = " 2147483647 "

     

     

    maxBufferPoolSize = " 524288 "

     

     

    maxReceivedMessageSize = " 2147483647 " >
    to that config?

    I have no idea how to test this, so I'm going to leave this as a 'guess', not an answer, if you can get it working based on this, it would be great to have the working answer posted for posterity.

    Thanks a lot :)

    I did as suggested but still no luck :(

    Have a look at my modified web.config so that you can have better idea:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <netNamedPipeBinding>
            <remove name="WorkflowControlNetPipeBinding" />
            <binding name="WorkflowControlNetPipeBinding" transactionFlow="true"
              maxBufferPoolSize="838860800" maxBufferSize="419430400" maxReceivedMessageSize="419430400">
              <security>
                <transport protectionLevel="Sign" />
              </security>
            </binding>
          </netNamedPipeBinding>
          <netTcpBinding>
            <remove name="WorkflowControlNetTcpBinding" />
            <binding name="WorkflowControlNetTcpBinding" transactionFlow="true"
              maxBufferPoolSize="838860800" maxBufferSize="419430400" maxReceivedMessageSize="419430400">
              <security>
                <transport protectionLevel="Sign" />
              </security>
            </binding>
          </netTcpBinding>
          <wsHttpBinding>
            <remove name="WorkflowControlHttpsBinding" />
            <binding name="WorkflowControlHttpsBinding" transactionFlow="true"
              maxBufferPoolSize="838860800" maxReceivedMessageSize="419430400">
              <security mode="Transport" />
            </binding>
            <remove name="WorkflowControlHttpBinding" />
            <binding name="WorkflowControlHttpBinding" transactionFlow="true"
              maxBufferPoolSize="838860800" maxReceivedMessageSize="419430400" />
          </wsHttpBinding>
        </bindings>
        <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="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>
    

    Thank you,
    Roobii :)
    Wednesday, December 23, 2009 9:04 PM
  • Hi Roobii,

    I looked at your configuration, you defined several bindings but the problem is they will not be used for Workflow services. I guess you are confused by "WorkflowControlEndpoint", which is a specific endpoint for WF controlling, e.g. terminate a WF instance.

    There are 2 ways to configure a WF service:

    1) Manually add service endpoint and service contract in configuration, and config it as normal WCF application. Following web.config is a sample of your WF service, note that the service name must match service name specified in XAML, and service contract must match XAML contract name as well.
     (<WorkflowService mc:Ignorable="sap" ConfigurationName="Mailbox">, service name must be "MailBox". same for service contract defined in receive activity)

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="MyBinding" />
          </basicHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="myBehavior" name="Mailbox">
            <endpoint binding="basicHttpBinding" bindingConfiguration="" name="IMailbox" contract="IMailbox" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="myBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>

    2) If you want to change all http binding based service configuration in your WF service application, you can change default protocal by adding following configuration:
        <protocolMapping>
          <remove scheme="http" />
          <add scheme="http" binding="basicHttpBinding" bindingConfiguration="MyBinding" />
        </protocolMapping>
    Where MyBinding is the binding configuration you want to used for all basicHttpBinding service. protocalMapping configuration can be find at "Advanced" tag of WCF service configuration editor.

    thanks,
    Anders

    This posting is provided "AS IS" and confers no rights or warranties.
    Friday, December 25, 2009 7:34 AM
  • Hi Roobii,

    There have been a lot of comments in this thread, but the solution for your problem was simple: you needed to change the buffer size for your service, and in order to do that you need to modify some properties in the binding used in your service endpoint.

    The config template for WF services has been designed taking into account the new default configuration model developed in .NET 4, which makes the <service> section in service configuration files optional. That largely reduces the size of configuration files and thus they become easier to modify and maintain. You can find more information about this new configuration model in this link: http://msdn.microsoft.com/en-us/library/ee354381.aspx or in this blog post: http://blogs.msdn.com/endpoint/archive/2009/06/30/service-configuration-improvements-in-net-4.aspx.

    In the particular case of your service, you need to define a binding, with an empty name, that changes the size of the buffer. This configuration file should be enough for you:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
          </basicHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>
    

    and you do not need to change anything else. In this case, you will have a WF service with an HTTP endpoint using that basicHttpBinding. No need of <service> section.

    If you wanted to use wsHttpBinding instead of basicHttpBinding, then you will need to use the <protocolMapping> section to change the default mapping between HTTP address scheme and the corresponding binding, something like:

        <protocolMapping>
          <add scheme="http" binding="wsHttpBinding" />
        </protocolMapping>

    Hope this helps.

    Saturday, January 9, 2010 4:46 AM