WCF Service Link Generates Null .cs Link Due to DuplexBinding

I have a WCF service. Here is the configuration

<basicHttpBinding> <binding name="EmergencyRegistratorBinding"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBinding> 

And setting up the service

  <service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="EmergencyRegistratorBinding" contract="Services.IEmergencyRegistrator" /> </service> 

Everything worked fine. But I needed to change basicHttpBingind to DuplexBinding. I added the extension:

 <extensions> <bindingElementExtensions> <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/> </bindingElementExtensions> </extensions> 

And changed the above lines to:

  <customBinding> <binding name="DuplexmergencyRegistratorBinding"> <binaryMessageEncoding/> <pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00"/> <httpTransport authenticationScheme="Negotiate"/> </binding> </customBinding> 

and

  <service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator"> <endpoint address="" binding="customBinding" bindingConfiguration="DuplexmergencyRegistratorBinding" contract="Breeze.Core.Services.IEmergencyRegistrator" /> <endpoint address="mex" binding="customBinding" bindingConfiguration="DuplexmergencyRegistratorBinding" contract="IMetadataExchange"/> </service> 

I added a service link to the WCF project. The link was added successfully, but Reference.cs was almost empty.

 //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.225 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ 

When I clear the " Reuse types in reference assemblies " checkbox, the code is generated, but there instead of 10 thousand lines instead of ~ 500

I run svcutil and I have the following:

svcutil.exe http: //localhost/Breeze.Workstation/Emergencies/EmergencyRegistrator.svc? wsdl

Trying to download metadata from 'http: //localhost/Breeze.Workstation/Emergencies/EmergencyRegistrator.svc? wsdl 'using WS-Metadata Exchange or DISCO. A warning. The following policies have not been imported: XPath: // WSDL: definitions [@ = target space 'HTTP://tempuri.org/'โ€ /WSDL: binding [@ name =' CustomBinding_IEmergencyRegistrator '] Statements: ..

Creating Files ... C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ EmergencyRegistrator.cs C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ output.config

I am completely new to WCF services. Hope someone can help me. Thanks.

0
source share
2 answers

I solved it. The empty link was caused by some issues with ambiguous types. When I fixed it, the reference.cs file was generated.

So, the solution is to look not only at errors, but also at warnings. I found there all the information that I need for my problem. Happy grass

+5
source

HTTP duplex binding is supported only by Silverlight clients. Since you are using svcutil to create the link, I assume that you are creating a โ€œnormalโ€ (ie Not SL) for the regular client, so this will not work.

If you want to use two-way binding in an application other than Silverlight, you can look at either wsDualHttpBinding or netTcpBinding .

0
source

Source: https://habr.com/ru/post/945567/


All Articles