我有一个巨大的超时问题,我不知道如何解决它!我使用windows服务客户端通过HTTPS连接到WCF服务。
我看过这个:http://blogs.msdn.com/b/hongmeig/archive/2010/03/06/timeouts-in-wcf-and-their-default-values.aspx
服务器端生成的错误
ServiceHost关闭操作在00:00:10之后超时。这可能是因为客户端未能在所需时间内关闭会话通道。分配给此操作的时间可能是较长超时的一部分。
在客户端生成的错误:
System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.System.IDisposable.Dispose()这是我对WCF服务的绑定:
<bindings>
<wsHttpBinding>
<binding name="Binding1" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true" />
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>这是代码客户端:
wsHttpBinding = new WSHttpBinding(SecurityMode.TransportWithMessageCredential)
{
CloseTimeout = new TimeSpan(0, 0, 10, 0),
OpenTimeout = new TimeSpan(0, 0, 10, 0),
ReceiveTimeout = new TimeSpan(0, 10, 0, 0),
SendTimeout = new TimeSpan(0, 0, 10, 0),
TransactionFlow = false,
MaxBufferPoolSize = 524288,
MaxReceivedMessageSize = 2147483647,
ReaderQuotas =
{
MaxDepth = 128,
MaxStringContentLength = int.MaxValue,
MaxArrayLength = 2147483647,
MaxBytesPerRead = 16384,
MaxNameTableCharCount = 16384
}
};
wsHttpBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
wsHttpBinding.ReliableSession.Ordered = true;
wsHttpBinding.ReliableSession.InactivityTimeout = new TimeSpan(0, 0, 10, 0);
wsHttpBinding.ReliableSession.Enabled = true;
Ednpoint = new EndpointAddress(new Uri(URL));
myChannelFactory = new ChannelFactory<IPoint>(wsHttpBinding, Ednpoint);
myChannelFactory.Endpoint.Contract.SessionMode = SessionMode.Allowed;
ClientCredentials cc = myChannelFactory.Endpoint.Behaviors.Find<ClientCredentials>();
cc.UserName.UserName = usr;
cc.UserName.Password = pass;
myChannelFactory.CreateChannel();我使用这段代码发送这样的数据:
using (IClientChannel client = (IClientChannel)myChannelFactory.CreateChannel())
{
client.OperationTimeout = TimeSpan.FromMinutes(10);
IPoint wcfClient1 = (IPoint)client;
for (int start = startpos; start < totalSize; start += size)
{
List<Point> send = r.Skip(start).Take(size).ToList();
xreturn = wcfClient1.Update(send);
counter += 1;
}
}发布于 2015-04-23 11:56:34
我已经解决了应用程序池一直在宿主服务器上重新启动的问题。
https://stackoverflow.com/questions/29498459
复制相似问题