Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF обрывается канал через 9 часов работы / 3 сообщений из 3, страница 1 из 1
23.04.2008, 13:58
    #35274152
anj78
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
WCF обрывается канал через 9 часов работы
Есть Сервер и Клиент. Клиент подключается к Серверу по дуплексному каналу.
После подключения нормально работает без малейших проблем.
Клиент каждые 2 минуты вызывает у сервера функцию CheckConnection для того, чтобы держать канал постоянно открытым.

Проблема состоит в том что через 9 часов нормальной работы на клиенте возникает исключение (см. ниже) а на с сервере канал переходит в Faulted state. После этого клиент переподключается (внутренняя логика работы клиента) и продолжает работать следующие 9 часов без проблем.

Подскажите в чем может быть причина. Мои догадки это время жизни сессии, если я прав, где установить это время?

Ошибка на клиенте:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Message: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
StackTrace:
Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at PT.DTL.IPTService.CheckConnection()
   at PT_BLL.Biz_objects.BizServerOperation.CheckConnection()


Настройки канала на клиенте :

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
        public static void CreateChannel()
        {
            try
            {
                callbackClass = new PosForLSCallback();
                instanceContext = new InstanceContext(callbackClass);
                Uri uri = new Uri(_uri);
                NetTcpBinding binding = new NetTcpBinding();
                binding.Security.Mode = SecurityMode.Message;
                binding.ReliableSession.InactivityTimeout = TimeSpan.MaxValue;
                binding.ReliableSession.Ordered = true;
                binding.ListenBacklog = 1000;
                binding.MaxConnections = 1000;
                binding.MaxReceivedMessageSize = 294967296;
                binding.MaxBufferSize = 294967296;
                binding.ReaderQuotas.MaxArrayLength = 294967296;
                binding.ReaderQuotas.MaxBytesPerRead = 294967296;
                binding.ReaderQuotas.MaxStringContentLength = 294967296;
                binding.OpenTimeout = TimeSpan.FromSeconds(30);
                binding.Security.Message.AlgorithmSuite
                     = System.ServiceModel.Security.SecurityAlgorithmSuite.Basic128Rsa15;

                binding.Security.Message.ClientCredentialType = MessageCredentialType.None;

                EndpointAddress ad = new EndpointAddress(
                    uri,
                    new DnsEndpointIdentity(BasicObject.CERTIFICATE_CAFE),
                    new AddressHeaderCollection());

                factoryLS = new DuplexChannelFactory<IPOSService>(instanceContext, binding, ad);
                factoryLS.Credentials.ServiceCertificate.Authentication.CertificateValidationMode
                    = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
                factoryLS.Credentials.ServiceCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine;
                factoryLS.Open();
                channel = factoryLS.CreateChannel();
            }
            catch (Exception ex)
            {
                VS2Exception.WriteError("CreateChannel", ex);
                Console.WriteLine(ex.Message);
            }
        }
Настройки канала на сервере:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
        private static void createPOSHost()
        {
            try
            {
                NetTcpBinding binding = binding = new NetTcpBinding(SecurityMode.Message);

                binding.MaxReceivedMessageSize = 294967296;
                binding.MaxBufferSize = 294967296;
                binding.ReaderQuotas.MaxArrayLength = 294967296;
                binding.ReaderQuotas.MaxBytesPerRead = 294967296;
                binding.ReaderQuotas.MaxStringContentLength = 294967296;
                binding.OpenTimeout = TimeSpan.FromSeconds(30);
                binding.ReliableSession.Ordered = true;
                binding.ListenBacklog = 1000;
                binding.MaxConnections = 1010;
                binding.ReceiveTimeout = TimeSpan.FromSeconds(VS2Settings.Instance().TerminalQueryInterval + TimeoutIncrease);
                binding.Security.Message.AlgorithmSuite
                 = System.ServiceModel.Security.SecurityAlgorithmSuite.Basic128Rsa15;
                binding.Security.Message.ClientCredentialType = MessageCredentialType.None;

                _posHost = new ServiceHost(typeof(POSService));
                _posHost.AddServiceEndpoint(
                    typeof(POS.DTL.IPOSService),
                    binding,
                    string.Format(BasicObjects.ConfigUtil.GetValue(LSARegistryKeys.POSService),
                        BasicObject.LSForPOSPort).Replace("[LS_IP]", LSIP));

                _posHost.Credentials.ServiceCertificate.Certificate = new X509Certificate2(Certs.VS2CAFE, "",
 		X509KeyStorageFlags.PersistKeySet);

                ServiceThrottlingBehavior stb = new ServiceThrottlingBehavior();
                stb.MaxConcurrentCalls = 1010;
                stb.MaxConcurrentInstances = 1010;
                stb.MaxConcurrentSessions = 1010;
                _posHost.Description.Behaviors.Add(stb);
                _posHost.Faulted += new EventHandler(_posHost_Faulted);
                _posHost.Open();

            }
            catch (Exception ex)
            {
                _log.Error(ex);
            }
        }
...
Рейтинг: 0 / 0
23.04.2008, 14:32
    #35274319
Alexes
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
WCF обрывается канал через 9 часов работы
Посмотрите ServiceBehaviorAttribute.IncludeExceptionDetailInFaults. Возможно, поможет найти причину.
...
Рейтинг: 0 / 0
02.06.2008, 18:21
    #35349844
anj78
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
WCF обрывается канал через 9 часов работы
Данная проблема решилась установкой framework 3.5
или сервис пака для 3.0

Скорее всего bug от Microsoft
...
Рейтинг: 0 / 0
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF обрывается канал через 9 часов работы / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]