If I send parameters which will cause a lot of data to be pulled I get the following error:
The request channel timed out while waiting for a reply after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
I have increased all of my timeouts. Is there something I have to do on the client side? I am wondering if this is because I am using wcftestclient? Do I need to adjust the operationTimeout?
My webconfig has the following:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Basic" sendTimeout="12:00:00" receiveTimeout="12:00:00" openTimeout="00:10:00" closeTimeout="00:10:00"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="8192"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CaseStudyBehavior" name="EDTFS.ADMS.CaseStudyService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="Basic"
name="Basic"
contract="EDTFS.ADMS.ICaseStudyService" />
<endpoint address="mex"
binding="mexHttpBinding"
name="Metadata"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CaseStudyBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceTimeouts transactionTimeout="24:00:00"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
In the WCF Test Client you will find a node called Config File beneath your service. Right-click this and select Edit with SvcConfigEditor to increase timeout on the client.
Related
Here are parts of the configuration file:
<services>
<service name="MMC.API2.MMCApi" behaviorConfiguration="restBehaviorConfig">
<endpoint address="" binding="webHttpBinding" contract="MMC.API2.IMMCApi" behaviorConfiguration="web" bindingConfiguration="LargeData">
</endpoint>
<host>
<timeouts openTimeout="01:20:00" closeTimeout="01:20:00" />
</host>
</service>
</services>
...
<webHttpBinding>
<binding name="LargeData" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
Problem:
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 fragments of the service’s binding configuration seem to be set ok, so you may want to look into the clients’ binding configurations to make sure they have similar settings for the readerQuotas and maxBuffer* settings.
Notes:
You may want to provide a bit more information about the overall environment/configuration.
If you haven’t already, enabling WCF trace logging may help you identify the issue.
It looks fine to me. Try to change the behavior configuration as below;
<serviceBehaviors>
<behavior name="web">
<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceTimeouts transactionTimeout="00:10:00" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="100"
maxConcurrentInstances="100" />
</behavior>
</serviceBehaviors>
I have a Silverlight application that uploads files in chunks to a WCF service. When I run both the service and the Silverlight app locally everything works fine. When I deploy them both to IIS it will work for files that are smaller than the chunk size (16k in this case) but if the file is larger than that it fails. It is almost exactly like the problem described here: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/19329afc-8a73-4756-80cd-bbdada75c0e2 but the solution there doesn't work for me, I already keep a strong reference to the WCF proxy instance. But in my case as in that one, a single asynch call will succeed but multiple calls will fail.
Here's the serviceModel entry from the web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="binaryHttpBinding" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00">
<binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" authenticationScheme="Anonymous" maxBufferSize="2147483647" transferMode="Buffered"/>
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="ADE.Web.IADEFileTransferService" >
<endpoint address="" binding="customBinding" bindingConfiguration="binaryHttpBinding"
contract="ADE.Web.ADEFileTransferService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
You need to have the same readerQuotas settings on both client and server side i.e. your silverlight config file needs to have the same settings as well.
Also consider adding the dataContractSerializer element in the serviceBehaviour tab with maxItemsInObjectGraph as shown below
<serviceBehaviors>
<behavior name="default">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
Also you can try to add the maxRequestLength value of httpRunTime element as shown below:
<system.web>
<httpRuntime maxRequestLength ="32768"/>
</system.web>
Can someone please tell me what I'm doing wrong below? I have been fighting with this for hours and believe that I have it right, but I have to be missing something. Basically for every service I have I would like to have to addresses. These services are to be hosted in IIS. I have been testing with IIS Express. My expectation is that I would access the services at /AuthService.svc/soap and /AuthService.svc/json, but that doesn't seem to be working. Below is the config I'm using.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="jsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="SecureBinding" allowCookies="true" maxReceivedMessageSize="67108864">
<readerQuotas maxArrayLength="67108864"/>
<security mode="Transport"/>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="SecureBinding" allowCookies="true" maxReceivedMessageSize="67108864">
<readerQuotas maxArrayLength="67108864"/>
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="AuthService" behaviorConfiguration="DefaultServiceBehavior">
<endpoint address="soap"
binding="basicHttpBinding"
bindingConfiguration="SecureBinding"
contract="FormsAuthenticatingServices.Interfaces.IAuthService" />
<endpoint address="json"
binding="webHttpBinding"
bindingConfiguration="SecureBinding"
behaviorConfiguration="jsonBehavior"
contract="FormsAuthenticatingServices.Interfaces.IAuthService" />
</service>
<service name="DataService" behaviorConfiguration="DefaultServiceBehavior">
<endpoint address="soap"
binding="basicHttpBinding"
bindingConfiguration="SecureBinding"
contract="FormsAuthenticatingServices.Interfaces.IDataService" />
<endpoint address="json"
binding="webHttpBinding"
bindingConfiguration="SecureBinding"
behaviorConfiguration="jsonBehavior"
contract="FormsAuthenticatingServices.Interfaces.IDataService" />
</service>
</services>
</system.serviceModel>
You should get the SOAP based metadata at /authservice.svc?wsdl and the REST based operations starting from the URI /authservice.svc/json
You will not see anything in a browser by hitting /authservice.svc/soap as SOAP assumes XML messages will be POSTed to the service whereas the browser is performing a GET. To use the SOAP service create a client project and generate a proxy using Add Service Reference pointing at the WSDL
In addition to Richard's answer, make sure the name attribute on the <service> element is the fully qualified name of the service class.
I have defined maxBufferSize = 2147483647, maxBufferPoolSize = 2147483647, maxReceivedMessageSize = 2147483647 in the server config file but when i generate client config file, values for all these parameters are defaulted in there and i have to edit them manually. This is how i generate the client config file
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config net.tcp:/
/localhost:4365/MyService
Also since i am using maximum values in the maxBufferSize, maxBufferPoolSize, maxReceivedMessageSize and maxItemsInObjectGraph, is that going to hit the performance?
--Server config values--
<bindings>
<netTcpBinding>
<binding name="MySvc_InsecureTcp" closeTimeout="00:01:10" openTimeout="00:01:10" receiveTimeout="24.20:31:23.6470000"
listenBacklog="1000" maxConnections="1000" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None">
<transport protectionLevel="None" />
</security>
</binding>
<binding name="MySvc_mexBinding" closeTimeout="00:01:10" openTimeout="00:01:10" receiveTimeout="24.20:31:23.6470000"
listenBacklog="1000" maxConnections="1000" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None">
<transport protectionLevel="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceThrottling maxConcurrentCalls="30" maxConcurrentInstances="2147483647" maxConcurrentSessions="30" />
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyNameSpace.MyService" behaviorConfiguration="MyService">
<endpoint address="" binding="netTcpBinding" contract="MyNameSpace.IMyService"
bindingConfiguration="MySvc_InsecureTcp" name="netTcpMySvc" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"
bindingConfiguration="MySvc_mexBinding" name="mexMySvc" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:4365/MyService"/>
</baseAddresses>
</host>
</service>
</services>
--After doing some more testing--
maxItemsInObjectGraph doesnt get included in the client config file. And if client is sending large objects, maxItemsInObjectGraph should be changed manually.
<behaviors>
<endpointBehaviors>
<behavior name="FASTServiceBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
Not every configuration value defined on the service is passed to the client through metadata. Buffer sizes and reader quotas are one example because each participant in the communication can setup its own values - those values are defense against Denial of Service attack and can differ between service and client based on exchanged messages. For example if you want only upload large data sets you must set them correctly on the service but you don't need to modify them on the client. Downloading has reverse effect.
This is normal. Those properties are limited to that configuration file and don't carry across the service. Clients and servers can have different size limits, largely to help protect the sever against outrageously long requests (that the client might be expecting).
I've got a WCF Web MEthod that takes in an XElement object as a parameter. For one of my XML files (sized at 600KB or so) this works just fine, however, for this bigger XML file (about 5MB) I get a CommunicationException right away.
I've already increased the message sizes for my binding. Below is the ServiceModel section of my web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="BIMIntegrationWS.metadataBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="BIMIntegrationWS.IntegrationService.customBinding0"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00">
<binaryMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="BIMIntegrationWS.BIMIntegrationWS" behaviorConfiguration="BIMIntegrationWS.metadataBehavior">
<endpoint address="" binding="customBinding" bindingConfiguration="BIMIntegrationWS.IntegrationService.customBinding0"
contract="BIMIntegrationWS.IBIMIntegrationService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
On the client, my ClientConfig looks like this:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IBIMIntegrationService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:1895/IntegrationService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_IBIMIntegrationService"
contract="BIMIntegrationService.IBIMIntegrationService" name="customBindingEndpoint" />
</client>
</system.serviceModel>
Thanks in advance!
try to add following snippet into your web.config for the service application:
<system.web>
<httpRuntime maxRequestLength="16384" /> <!-- 16MB -->
</system.web>
When you host the service in web server you also have to tweak allowed request size for the web server.
Best regards,
Ladislav
Maybe your XElement has too many nodes/child elements, and you need to set the maxItemsInObjectGraph attribute under dataContractSerializer to something larger?
You probably need to change the values of the attributes of the <readerQuotas /> sub element of <binaryMessageEncoding />.
For more information, see:
http://msdn.microsoft.com/en-us/library/ms731325.aspx
http://forums.silverlight.net/forums/p/88704/205040.aspx
Update:
Can you try to increase the maxAllowedContentLength as described here:
http://social.msdn.microsoft.com/Forums/en/wcf/thread/e6e21132-ad3f-4135-8ab9-77923b099907
Do you know how to turn off VS host and to just deploy to IIS and give it a ping. Normal IIS 7 on your dev box will do just fine. You can still attach debugger etc, just won't have instantaneous F5 gratification but since your ocode is not dying on startup you don't need to see if from the fist line anyway :-)
If you would need to attach very early you could could make a mimimal method that doesn't tounch anything at all and just returns int constnat - just to bring up app pool so you can attach.