Why WSHttpBinding convert to CustomBinding ?
I am using WCF Connected Service to generate the WCF client code , I see some code like this --
Why when endpointConfiguration = WSHttpBinding then create a CustomBinding, are they total compatible ?
private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
{
if ((endpointConfiguration == EndpointConfiguration.WSHttpBinding_IExchangeRateService))
{
System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
result.Elements.Add(textBindingElement);
System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement();
httpBindingElement.AllowCookies = true;
httpBindingElement.MaxBufferSize = int.MaxValue;
httpBindingElement.MaxReceivedMessageSize = int.MaxValue;
result.Elements.Add(httpBindingElement);
return result;
}
throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
}
WsHttpBinding isn't currently supported, see issue #31. They are probably not completely compatible, but I've found I can make at least basic calls to WS-* based services.
Hi @gzpbx, as @StrangeWill explained it is because the WS* bindings are not currently supported in .NET Core. Please let us know if you run into any issues.
CustomBinding code not working for me, unfortunately:
System.ServiceModel.FaultException was unhandled by user code
HResult=-2146233088
Message=The message could not be processed. This is most likely because the action 'http://tempuri.org/IMrsWhatService/FindTerms' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
Source=System.Private.ServiceModel
StackTrace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at BackgroundService.WhatServiceAdapter.<InternalFindTerms>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at BackgroundService.CortanaCanvas.<ProcessDefinitionRequest>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at BackgroundService.CortanaCanvas.<Run>d__1.MoveNext()
InnerException:
cc @StrangeWill
Ouch, yeah you'll need to wait for WsHttpBinding support then @bc3tech :(
@zhenlan @StrangeWill the CustomBinding working fine for me when the wcf server only support WsHttpBinding binding , I think if there is no security demand CustomBinding works fine.
Hi @gzpbx -- what is the latest status on this issue? Is using a CustomBinding without asking for security an adequate workaround for you? Thanks.
@roncain, it's OK for me. And our product is running online. Just weird ...
Closing. Thanks for the update @gzpbx!
so.... this is closed because it works now? my error above should no longer happen?
Sorry for my brevity @bc3tech. Please let me explain.
This issue is about "why WSHttpBinding convert to CustomBinding" in the code generated by WCF Connected Service. The answer to that is because WSHttpBinding is currently not supported. I understand CustomBinding may not work for all scenarios as an alternative solution. To ultimately solve this issue, it requires the support of WS*Binding, which is tracked in #31. There is nothing more for this issue to track and thus closed. Does this make sense to you?
Is there any workarounds? I tried creating custom bindings, but there is a mismatch between Soap 1.1 and 1.2.