I have the following WCF client code:
string add = String.Format("http://localhost:{0}/ServiceRequestRest",accessPort);
var cf = new ChannelFactory<IServiceRequestRest>(new WebHttpBinding(), add);
cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
busService = cf.CreateChannel();
busService.DoMyStuff("hello",null);
When I have the βfirst chance of exceptionβ activated, this last line of code throws a series of exceptions. First exception:
System.InvalidOperationException occurred
Message = "Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers."
Source = "System.ServiceModel"
Stacktrace:
at System.ServiceModel.Channels.MessageHeaders.ValidateHeaderKind (HeaderKind headerKind)
I do not know that I am trying to "add message headers", but I decided to continue execution and immediately get the following exception:
System.Net.WebException occurred
Message = "The underlying connection was closed: The connection was closed unexpectedly."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
, . ?
. REST , . , , , . catch , , , " ". ?
Update2. , . Skype. .:)