Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

AGAIN with the (413) Request Entity Too Large! Any help welcome...

$
0
0
Okay, I thought I had this stupid problem fixed. I'm running WCF with a client/server setup. Windows 7, VS 2012, .NET 4.5.

I've got the app working mostly fine, but when I started expanded testing I ran into this error AGAIN. I query list of policies, which are returned fine, select one from the list, and query for the entire selected policy. This is retrieved fine and displayed in the client... the policy edit form. The problem comes when I try to save even a small change... the data is rejected with the 413 message. Keep in mind that it is rejecting the exact same policy data that it just sent to the client. Not sure what's up, because I've got maxReceivedMessageSize set to 2 billion on both the client and the server.

Here is the app.config for the client:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <!--<binding name="basicHttpBinding_IPolicyMaintenanceService" maxReceivedMessageSize="2147483647"/>-->
                <binding name="BasicHttpBinding_IPolicyMaintenanceService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:30:00" sendTimeout="00:30:00" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:8080/UnicorMedServices/PolicyMaintenanceService"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPolicyMaintenanceService"
                contract="PolicyServiceRef.IPolicyMaintenanceService" name="BasicHttpBinding_IPolicyMaintenanceService" />
        </client>
    </system.serviceModel>
</configuration>

And here is the web.config for the service:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="PolicyEntities" connectionString="metadata=res://*/Policy.csdl|res://*/Policy.ssdl|res://*/Policy.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\MGivens;initial catalog=CodeWizard;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <!--<add name="PolicyEntities" connectionString="metadata=res://*/Policy.csdl|res://*/Policy.ssdl|res://*/Policy.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=Server-AD;initial catalog=PolicyManagement;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
    <!--<add name="PolicyEntities" connectionString="metadata=res://*/Policy.csdl|res://*/Policy.ssdl|res://*/Policy.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=Server-AD;initial catalog=CodeWizard;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
  </connectionStrings>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
 
  <!-- When deploying the service library project, the content of the config file must be added to the host's
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <serviceHostingEnvironment>
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./PolicyMaintenanceService.svc" service="UnicorMedServices.PolicyMaintenanceService"/>
      </serviceActivations>
    </serviceHostingEnvironment>
    <services>
      <service name="UnicorMedServices.PolicyMaintenanceService">
        <endpoint address="" binding="basicHttpBinding" contract="UnicorMedServices.IPolicyMaintenanceService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/UnicorMedServices/PolicyMaintenanceService" />
          </baseAddresses>
        </host>
      </service>
    </services>

    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:30:00" sendTimeout="00:30:00">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647"
            maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
   
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information,
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
  </system.serviceModel>

</configuration>

So, the question becomes, since I've got the received message and buffer sizes set to 2 billion, and since the policy I'm testing this on is nowhere NEAR that large, what am I missing to get this to work? I thought I had this licked when it arose querying lists of policies, but I guess not.

ALL help is welcome...

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>