Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recover from
Message
From
08/09/2011 16:32:10
 
 
To
08/09/2011 15:01:58
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Windows Communication Foundation (WCF)
Title:
Miscellaneous
Thread ID:
01523035
Message ID:
01523046
Views:
40
>>>Hi all,
>>>
>>>If a Service call results in an exception because the connection is closed, (see below) does the binding and endpoint all need to be build again before a retry can be made? I could probably test this, but would have to write a bunch of code to find out and cause the failure. I was hoping someone knew the answer. Just wondering if the proxy is toast after this failure.
>>>
>>>
>>>09/07/11 10:48:46|dlewis5|342560768|An existing connection was forcibly closed by the remote host in System
>>>Stack trace:
>>>   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
>>>   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
>>>Call stack:
>>>   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
>>>   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
>>>
>>>
>>
>>Did you just use the 'Add Service Reference' to generate the client service code ?
>>Not that I'd know the answer to your question anyway :-{
>
>Hi Viv,
>
>Not exactly. The binding is created proxy instantiated in this factory method at runtime.
>
>
>private bool CreateWebServiceProxy()
>{
>      if (ServiceDispatcher != null)
>	return true;
>
>      // Pretest for method safety
>      if (ServerUris == null || ServerUris.Count < 1)
>	return false;
>
>      bool success = false;
>
>      var binding = new BasicHttpBinding
>	{
>		MaxBufferSize = 20 * 1024 * 1024,
>		MaxReceivedMessageSize = 20 * 1024 * 1024,
>		ReaderQuotas = XmlDictionaryReaderQuotas.Max
>	};
>
>      foreach (string uri in ServerUris)
>      {
>	binding.Security.Mode = uri.ToUpper().StartsWith("HTTPS:") ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None;
>
>
>	_endpoint = new EndpointAddress(uri);
>	var customBinding = new CustomBinding(binding);
>	BindingElementCollection elements = customBinding.CreateBindingElements();
>
>	foreach (var element in elements.OfType<HttpTransportBindingElement>())
>	{
>		(element).KeepAliveEnabled = false;
>	}
>
>	ServiceDispatcher = new WSDispatcherSEIClient(customBinding, _endpoint);
>	Global.Log.Add(LoggingDebugLevel.Hint, string.Format("Communicator.Connect: trying to connect to '{0}'...", this._endpoint));
>
>	success = CheckService();
>
>	if (success)
>	{
>	      _callWebServiceTotal = 0;
>	      Global.Log.Add(LoggingDebugLevel.Hint, string.Format("Communicator.Connect: connected to '{0}'", this._endpoint));
>
>	      // Got a valid uri, so call it good and get out.
>	      break;
>	}
>      }
>return success;
>}
>
So the important bit here is the WSDispatcherSEIClient class? Is that derived from a WCF .class ?
IAC, if I interpret this correctly, the CreateWebServiceProxy() method spins through a list of possible uri's until it finds one that works and assigns the working version to ServiceDispatcher - and it looks as if once this has run once then it will never change unless ServiceDispatcher is explicitly set to null ? The implication there being that it should not be neccessary to recreate the proxy.
OTOH that assumption could be wrong :-{
Sorry, just thinking aloud really, not much help......
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform