我有 WCF 服务。这里是配置
<basicHttpBinding>
<binding name="EmergencyRegistratorBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
和服务配置
<service behaviorConfiguration="Default" name="Breeze.AppServer.Emergencies.EmergencyRegistrator">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="EmergencyRegistratorBinding"
contract="Services.IEmergencyRegistrator" />
</service>
一切正常。但我需要将 basicHttpBingind 更改为 DuplexBinding。我添加了扩展名:
<extensions>
<bindingElementExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
</bindingElementExtensions>
</extensions>
并将上述行更改为:
<customBinding>
<binding name="DuplexmergencyRegistratorBinding">
<binaryMessageEncoding/>
<pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00"/>
<httpTransport authenticationScheme="Negotiate"/>
</binding>
</customBinding>
和
<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>
我已将服务引用添加到 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>
//------------------------------------------------------------------------------
当我取消选中选项“在引用的程序集中重用类型”时,会生成代码但有超过 10000 行而不是 ~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 服务很陌生。我希望有人能帮助我。谢谢。