0

我有 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 服务很陌生。我希望有人能帮助我。谢谢。

4

2 回答 2

5

我已经解决了。空引用是由于类型不明确的一些问题。当我修复它时,reference.cs 文件生成得很好。

因此,解决方案是不仅要查看错误,还要查看警告。我在那里找到了解决问题所需的所有信息。快乐编码

于 2012-02-13T04:54:21.110 回答
0

只有 Silverlight 客户端支持轮询双工 HTTP 绑定。由于您svcutil用于生成参考,我假设您正在为服务器构建一个“普通”(即非 SL)客户端,因此这将不起作用。

如果您想在非 Silverlight 应用程序上使用双工装订,您可以查看wsDualHttpBindingnetTcpBinding.

于 2012-02-10T14:53:20.930 回答