Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Every binding must have at least one binding element that derives from TransportBindingElement

$
0
0

I am having Wcf Service with custom binding and exposed as HTTP proto call. I am trying to consume the wcf service in my asp.net core by scaffolding.

Here is my App.config

<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomWsBinding" receiveTimeout="03:00:00">
<byteStreamMessageEncoding/>
<httpTransport>
<webSocketSettings transportUsage="Always" createNotificationOnConnection="true" keepAliveInterval="03:00:00"/>
</httpTransport>
</binding>
</customBinding>
</bindings>
<services>
<service name="WCF_WebSocket.TestService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="customBinding" bindingConfiguration="CustomWsBinding" contract="WCF_WebSocket.ITestService" >
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:13060"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"></serviceMetadata>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

Here is the code for generating proxy 

public void Wrapper()
{
try
{
ITestService mClient;
var Inst = new InstanceContext(this);

var b = new CustomBinding();
b.SendTimeout = new TimeSpan(1, 59, 59);
b.ReceiveTimeout = new TimeSpan(1, 59, 59);
var add = new EndpointAddress("ws://localhost:13060/");
var cf = new ChannelFactory<ITestService>(b, add);
mClient = cf.CreateChannel();

if (mClient != null)
{
Console.WriteLine("initilized");
}
}
catch (Exception e)
{
Console.WriteLine(e);
Console.ReadKey();
}
}

I am getting exception in the catch block.

The CustomBinding on the ServiceEndpoint with contract 'ITestService' lacks a TransportBindingElement. Every binding must have at least one binding element that derives from TransportBindingElement.

The below links didnt helped me. I got struck on this.  Did i miss something

https://stackoverflow.com/questions/35599987/custombinding-lacks-a-transportbindingelement-when-trying-to-add-gzip-compressio 

https://social.msdn.microsoft.com/Forums/vstudio/en-US/7af2aecb-742d-41e4-a69f-9274e97dadf3/custombinding-lacks-a-transportbindingelement?forum=wcf 


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>