Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF: Server responding with Bad Request (400)
    primarykey
    data
    text
    <p>My WCF client works OK with WCF server except when making a call to the server trying to pass array of custom objects. When the array is 100 items it works fine, but when number of items is 300 the server throws exception Bad Request (400). So I assume that the key to the solution is in configuration files.</p> <p>First of all here is the app.config for the client. The WCF client resides in a DLL which is Outlook Add-In. I copy this app.config to Outlook.exe.config to Outlook installation dir - something that is required for the Add-In to be loaded by Outlook:</p> <pre><code>&lt;configuration&gt; &lt;configSections&gt; &lt;sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt; &lt;section name="MyProject.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;wsDualHttpBinding&gt; &lt;binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"&gt; &lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /&gt; &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" /&gt; &lt;security mode="Message"&gt; &lt;message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsDualHttpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="JabberService.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"&gt; &lt;/endpoint&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; &lt;system.diagnostics&gt; &lt;trace autoflush="true" /&gt; &lt;sharedListeners&gt; &lt;add name="sharedListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="%AppData%\Mfg\ProjectName\Logs\SwitchvoxDialerTraceLog.svclog" /&gt; &lt;/sharedListeners&gt; &lt;sources&gt; &lt;source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" propagateActivity="true"&gt; &lt;listeners&gt; &lt;add name="sharedListener"/&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;source name="System.ServiceModel.MessageLogging" switchValue="Verbose"&gt; &lt;listeners&gt; &lt;add name="sharedListener" /&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;/sources&gt; &lt;/system.diagnostics&gt; &lt;userSettings&gt; &lt;SwitchvoxDialer.Properties.Settings&gt; &lt;setting name="InstallSubFolder" serializeAs="String"&gt; &lt;value&gt;Mfg\\ProjectName&lt;/value&gt; &lt;/setting&gt; &lt;setting name="DialerTitle" serializeAs="String"&gt; &lt;value&gt;ProjectName&lt;/value&gt; &lt;/setting&gt; &lt;/SwitchvoxDialer.Properties.Settings&gt; &lt;/userSettings&gt; &lt;/configuration&gt; </code></pre> <p>The relevant part of the server config looks like this:</p> <pre><code> &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WcfServiceLib.JabberSvc" behaviorConfiguration="JabberSvc"&gt; &lt;endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="WcfServiceLib.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"&gt; &lt;identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:9047/switchvox/alerter"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="JabberSvc"&gt; &lt;dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483646" /&gt; &lt;serviceTimeouts transactionTimeout="00:10:00" /&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="True"/&gt; &lt;!-- 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 --&gt; &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;bindings&gt; &lt;wsDualHttpBinding&gt; &lt;binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"&gt; &lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/&gt; &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"/&gt; &lt;security mode="Message"&gt; &lt;message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsDualHttpBinding&gt; &lt;/bindings&gt; &lt;!-- Enable message tracing by adding this section - Remove for production code --&gt; &lt;diagnostics&gt; &lt;messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="100000" /&gt; &lt;/diagnostics&gt; &lt;/system.serviceModel&gt; </code></pre> <p>The app.config produces ServerName.exe.config that in bin/Debug (previously I had it as embedded resource but it did not help either...</p> <p>As you can see I increased all the numbers for buffers, messages, etc. to maximum and made sure that the time values are high enough... I am convinced that that the problem is that somehow either the server or the client do not know about these increased values, but cant figure out why...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload