|
Callback. WSDualHttpBinding
#36632622
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
|
|
|
|
Клиент и сервер на разных машинах
Через 1мин после обращения к веб методу(на s.DoWork()): "The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout."
Подскажите ПЛЗ в чем проблема?
Service:
1. 2. 3. 4. 5. 6. 7. 8.
public class Service1 : IService1
{
public void DoWork()
{
Thread.Sleep( 5000 );
OperationContext.Current.GetCallbackChannel<ICallback>().Notify("Notify");
}
}
Server:
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.
var httpAddress = new Uri("http://localhost/Service1.svc");
ServiceHost host2 = new ServiceHost(typeof(Service1), httpAddress);
WSDualHttpBinding wsDualHttpBinding = new WSDualHttpBinding();
wsDualHttpBinding.TransactionFlow = true;
wsDualHttpBinding.SendTimeout = new TimeSpan( 0 , 4 , 0 , 0 );
wsDualHttpBinding.ReceiveTimeout = new TimeSpan( 0 , 4 , 0 , 0 );
wsDualHttpBinding.OpenTimeout = new TimeSpan( 0 , 0 , 10 , 0 );
wsDualHttpBinding.CloseTimeout = new TimeSpan( 0 , 0 , 10 , 0 );
wsDualHttpBinding.Security.Mode = WSDualHttpSecurityMode.None;
wsDualHttpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
wsDualHttpBinding.MaxReceivedMessageSize = 2147483647 ;
wsDualHttpBinding.MaxBufferPoolSize = 0 ;
wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxDepth = 32 ;
wsDualHttpBinding.ReaderQuotas.MaxNameTableCharCount = 16384 ;
host2.AddServiceEndpoint(typeof(IService1), wsDualHttpBinding, "");
var bindingElement = new WSHttpBinding();
var metadataBinding = new CustomBinding(bindingElement);
host2.Description.Behaviors.Add(new System.ServiceModel.Description.ServiceMetadataBehavior());
host2.AddServiceEndpoint(typeof(IMetadataExchange), metadataBinding, "MEX");
host2.Open();
Console.WriteLine("Press enter to exit");
Console.ReadLine();
Client:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.
WSDualHttpBinding wsDualHttpBinding = new WSDualHttpBinding();
wsDualHttpBinding.TransactionFlow = true;
wsDualHttpBinding.SendTimeout = new TimeSpan( 0 , 4 , 0 , 0 );
wsDualHttpBinding.ReceiveTimeout = new TimeSpan( 0 , 4 , 0 , 0 );
wsDualHttpBinding.OpenTimeout = new TimeSpan( 0 , 0 , 1 , 0 );
wsDualHttpBinding.CloseTimeout = new TimeSpan( 0 , 0 , 10 , 0 );
wsDualHttpBinding.Security.Mode = WSDualHttpSecurityMode.None;
wsDualHttpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
wsDualHttpBinding.MaxReceivedMessageSize = 2147483647 ;
wsDualHttpBinding.MaxBufferPoolSize = 0 ;
wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
wsDualHttpBinding.ReaderQuotas.MaxDepth = 32 ;
wsDualHttpBinding.ReaderQuotas.MaxNameTableCharCount = 16384 ;
InstanceContext ic = new InstanceContext(new Callback());
DuplexChannelFactory<IService1> f = new DuplexChannelFactory<IService1>(ic, wsDualHttpBinding, new EndpointAddress("http://ticserv04/Service1.svc"));
var s = f.CreateChannel();
s.DoWork();
|
|
|