Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why WSHttpBinding convert to CustomBinding ? #1370

Closed
gzpbx opened this issue Jul 14, 2016 · 11 comments
Closed

Why WSHttpBinding convert to CustomBinding ? #1370

gzpbx opened this issue Jul 14, 2016 · 11 comments
Labels
feature request Adding new functionality requiring adding an API to the public contract. tooling An issues related to any tool shipped from this repo.

Comments

@gzpbx
Copy link

gzpbx commented Jul 14, 2016

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));
        }
@StrangeWill
Copy link

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.

@zhenlan zhenlan added the tooling An issues related to any tool shipped from this repo. label Jul 18, 2016
@zhenlan
Copy link
Member

zhenlan commented Jul 18, 2016

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.

@bc3tech
Copy link

bc3tech commented Jul 20, 2016

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

@StrangeWill
Copy link

Ouch, yeah you'll need to wait for WsHttpBinding support then @bc3tech :(

@zhenlan zhenlan added the feature request Adding new functionality requiring adding an API to the public contract. label Jul 20, 2016
@gzpbx
Copy link
Author

gzpbx commented Jul 23, 2016

@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.

@roncain
Copy link
Contributor

roncain commented Dec 5, 2016

Hi @gzpbx -- what is the latest status on this issue? Is using a CustomBinding without asking for security an adequate workaround for you? Thanks.

@gzpbx
Copy link
Author

gzpbx commented Jan 11, 2017

@roncain, it's OK for me. And our product is running online. Just weird ...

@zhenlan
Copy link
Member

zhenlan commented Jan 25, 2017

Closing. Thanks for the update @gzpbx!

@zhenlan zhenlan closed this as completed Jan 25, 2017
@bc3tech
Copy link

bc3tech commented Jan 25, 2017

so.... this is closed because it works now? my error above should no longer happen?

@zhenlan
Copy link
Member

zhenlan commented Jan 25, 2017

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?

@viktorpeacock
Copy link

Is there any workarounds? I tried creating custom bindings, but there is a mismatch between Soap 1.1 and 1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Adding new functionality requiring adding an API to the public contract. tooling An issues related to any tool shipped from this repo.
Projects
None yet
Development

No branches or pull requests

6 participants