I am calling SQL Stored Procedure which modify the hufe data. There is no problem with synchronous Call.
But when I call Async I m getting Timeout Error. Below are the code and configuration I follwed
Error Description while calling WCF Asynchronously
This request operation sent to net.tcp://localhost:8731/GEPQPService/ did not receive a reply within the configured timeout (00:01:00). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is
still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service
is able to connect to the client.
public void AsyncWcf()
{
var basicHttpBinding = new NetTcpBinding();
var objQPWCFService = new QAPackageServiceClient.QAPackageServiceClient();
EndpointAddress endpointAddress = objQPWCFService.Endpoint.Address;
IQAPackageService objIQPWCFService =
new ChannelFactory<IQAPackageService>
(basicHttpBinding, endpointAddress).CreateChannel();
//h, m, s
objQPWCFService.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);
For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.
here are the explanation of different timeout types:
shanawazday
Member
22 Points
24 Posts
Request Timeout in Async Call to WCF
Jul 27, 2012 07:36 AM|LINK
I am calling SQL Stored Procedure which modify the hufe data. There is no problem with synchronous Call.
But when I call Async I m getting Timeout Error. Below are the code and configuration I follwed
Error Description while calling WCF Asynchronously
This request operation sent to net.tcp://localhost:8731/GEPQPService/ did not receive a reply within the configured timeout (00:01:00). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.
This is my WCF Configuration
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IUpdateStatus" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="netTcpBinding_IQAPackageService" closeTimeout="01:01:00"
openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
hostNameComparisonMode="StrongWildcard" maxBufferSize="8000000" maxBufferPoolSize="8000000"
maxReceivedMessageSize="8000000">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="01:00:00" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="http://localhost/GepQualityPackage/UpdateStatus.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUpdateStatus" contract="GepUpdateProcessStatus.IUpdateStatus" name="BasicHttpBinding_IUpdateStatus" />
</client>
<services>
<service behaviorConfiguration="GEPWcfServices.Service1Behavior" name="GEPWcfServices.QAPackageService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBinding_IQAPackageService" contract="GEPWcfServices.IQAPackageService" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<!--172.16.200.110:8731-->
<add baseAddress="net.tcp://localhost:8731/GEPQPService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="MyCallbackBehavior">
<callbackTimeouts transactionTimeout="01:00:00" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="GEPWcfServices.Service1Behavior">
<serviceTimeouts transactionTimeout="10:10:00" />
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Web Config file Configuration
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IQAPackageService" closeTimeout="01:01:00"
openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
maxBufferSize="8000000" maxConnections="10" maxReceivedMessageSize="8000000">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="01:00:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8731/GEPQPService/" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IQAPackageService" contract="QAPackageServiceClient.IQAPackageService" behaviorConfiguration="MyCallbackBehavior"
name="NetTcpBinding_IQAPackageService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="GepQualityPackage.UpdateStatusBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MyCallbackBehavior">
<callbackTimeouts transactionTimeout="01:00:00" />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="GepQualityPackage.UpdateStatusBehavior" name="GepQualityPackage.UpdateStatus">
<endpoint address="" binding="basicHttpBinding" contract="GepQualityPackage.IUpdateStatus">
<identity>
<dns value="http://localhost/GepQualityPackage/UpdateStatus.svc"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
And C# code
public void AsyncWcf()
{
var basicHttpBinding = new NetTcpBinding();
var objQPWCFService = new QAPackageServiceClient.QAPackageServiceClient();
EndpointAddress endpointAddress = objQPWCFService.Endpoint.Address;
IQAPackageService objIQPWCFService =
new ChannelFactory<IQAPackageService>
(basicHttpBinding, endpointAddress).CreateChannel();
//h, m, s
objQPWCFService.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);
AsyncCallback aSyncCallBack =
delegate(IAsyncResult result)
{
try
{
string requestResult = objIQPWCFService.EndrunProcess(result);
}
catch (Exception ex)
{
throw new ApplicationException(ex.Message);
}
};
try
{
objIQPWCFService.BeginrunProcess(this.MasterData._connectionString, objProcessList.ToArray(), logInfo.serverName, logInfo.databaseName, logInfo.mainTableName,
aSyncCallBack, objIQPWCFService);//objIQPWCFService);
}
catch (Exception ex)
{
throw new ApplicationException(ex.Message);
}
}
Rohit Rao
Participant
1869 Points
357 Posts
Re: Request Timeout in Async Call to WCF
Jul 27, 2012 01:57 PM|LINK
For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.
here are the explanation of different timeout types:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/
shanawazday
Member
22 Points
24 Posts
Re: Request Timeout in Async Call to WCF
Aug 02, 2012 10:04 AM|LINK
For a Client I set sendTimeout one hour and For a Service set receiveTimeout one hour , but there was problem with security with netTCPBinding.
Used other binding, it worked...