I have been trying to figure this out for days, to no avail. This happens both when I try to debug in Visual Studio using IIS Express and with my production web site deployed to a machine running IIS 7.5.
I have called the service from a Visual Studio Unit Test using HttpWebRequest
and in Fiddler 4, same errors. So I don't think this is a WCF client configuration, as I am not using one.
No matter what I change in my configuration file, I am always getting this exception:
"Exception thrown: 'System.ServiceModel.ProtocolException' in
System.ServiceModel.dll
Additional information: The maximum message size quota for incoming messages
(65536) has been exceeded. To increase the quota, use the
MaxReceivedMessageSize property on the appropriate binding element."
The below Web.config that I am attaching is for an application that is not at the root of my server.
I am calling using the json endpoint using Ajax.
I cannot for the life of me figure out why I am getting the 64K limit, especially given that I have added all of the items to the webHttpBinding
as below.
I have also changed the httpRuntime
element by adding the maxRequestLength
item, changed the request filtering, the security settings, and a whole slew of other things that didn't make a difference.
Notice also that I have turned on tracing. The .svclog
file didn't tell me anything more.
Thanks in advance for any help.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="FactoryType" value="Production"/>
<add key="TravelRequestConnectionString" value="Data Source=ITLCS.benderson.com;Initial Catalog=TestTravelRequestSite;User Id=XXXX;Password=XXXXX"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
<membership defaultProvider="ADMembershipProvider">
<providers>
<clear />
<add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" />
</providers>
</membership>
</system.web>
<system.serviceModel>
<services>
<service name="TravelRequestWebService.TravelRequestService">
<endpoint
address="web"
binding="basicHttpBinding"
contract="TravelRequestWebService.ITravelRequestService" />
<endpoint
address="json"
binding="webHttpBinding"
behaviorConfiguration="jsonBehavior"
contract="TravelRequestWebService.ITravelRequestService" />
<endpoint
address=""
binding="basicHttpBinding"
contract="TravelRequestWebService.ITravelRequestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehavior">
<!-- 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>
<behavior name="bigBehavior">
<dataContractSerializer maxItemsInObjectGraph="200"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
<behavior name="jsonBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBinding" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000">
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="basicHttpBinding" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000">
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="CardSpace">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\log\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
</configuration>