Art*_*iom 0 wcf custom-binding pollingduplexhttpbinding
我有WCF服务.这是配置
<basicHttpBinding>
<binding name="EmergencyRegistratorBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
Run Code Online (Sandbox Code Playgroud)
和服务配置
<service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="EmergencyRegistratorBinding"
contract="Services.IEmergencyRegistrator" />
</service>
Run Code Online (Sandbox Code Playgroud)
一切都很好.但我需要将basicHttpBingind更改为DuplexBinding.我添加了延伸:
<extensions>
<bindingElementExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
</bindingElementExtensions>
</extensions>
Run Code Online (Sandbox Code Playgroud)
并改变上面提到的行:
<customBinding>
<binding name="DuplexmergencyRegistratorBinding">
<binaryMessageEncoding/>
<pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00"/>
<httpTransport authenticationScheme="Negotiate"/>
</binding>
</customBinding>
Run Code Online (Sandbox Code Playgroud)
和
<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>
Run Code Online (Sandbox Code Playgroud)
我已将服务参考添加到WCF项目.引用已成功添加,但Reference.cs几乎为空.
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
当我取消选中" 在引用的程序集中重用类型 "选项时,会生成代码但是有超过10万行代替~500
我运行了svcutil,我接下来了:
svcutil.exe http://localhost/Breeze.Workstation/Emergencies/EmergencyRegistrator.svc?wsdl
尝试使用WS-Metadata Exchange或DISCO从'http://localhost/Breeze.Workstation/Emergencies/EmergencyRegistrator.svc?wsdl'下载元数据.警告:未导入以下策略断言:XPath:// wsdl:definitions [@ targetNamespace ='http://tempuri.org/']/wsdl:binding [@ name ='CustomBinding_IEmergencyRegistrator']断言:..
生成文件... C:\ Program Files(x86)\ Microsoft Visual Studio 10.0\VC\EmergencyRegistrator.cs C:\ Program Files(x86)\ Microsoft Visual Studio 10.0\VC\output.config
我对WCF服务很陌生.我希望有人能够帮助我.谢谢.
我已经解决了这个问题.空引用是由于模糊类型的一些问题.当我修复它时,reference.cs文件生成良好.
因此,解决方案不仅要查看错误,还要注意警告.我发现了我的问题需要的所有信息.快乐的编码