【问题标题】:Windows Azure App Fabric: Configuration binding extension 'system.serviceModel/bindings/netTcpRelayBinding' could not be foundWindows Azure App Fabric:找不到配置绑定扩展“system.serviceModel/bindings/netTcpRelayBinding”
【发布时间】:2013-01-25 19:07:00
【问题描述】:

我目前正在为 Windows Azure 开发 .net 应用程序。我已按照一些教程为要在 Azure 上托管的本地服务设置中继。这似乎有效。

但是,当我使用客户端对其进行测试时,我无法下载元数据。我收到以下错误:

URI 前缀无法识别。 找不到配置绑定扩展“system.serviceModel/bindings/netTcpRelayBinding”。验证此绑定扩展是否已在 system.serviceModel/extensions/bindingExtensions 中正确注册并且拼写正确。 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。

似乎较旧版本的 appfabric sdk 将扩展写入 machine.config,但较新版本没有,您必须将其添加到您的 app.config。或者您可以使用 nugget 安装 windowsazure.servicebus 包,它会为您编写扩展。我已经这样做了,所以 app.config 确实包含 system.serviceModel/extensions/bindingExtensions/netTcpRelayBinding

这是我的 app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
    <extensions>
          <!-- In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->
      <behaviorExtensions>
        <add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </behaviorExtensions>
      <bindingElementExtensions>
        <add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="tcpRelayTransport" type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="httpRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="httpsRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="onewayRelayTransport" type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </bindingElementExtensions>
      <bindingExtensions>
        <add name="basicHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="webHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="ws2007HttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="netTcpRelayBinding" type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="netOnewayRelayBinding" type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="netEventRelayBinding" type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </bindingExtensions>
    </extensions>
    <client>
      <endpoint address="" binding="netTcpRelayBinding" contract="IMetadataExchange" name="sb"/>
    </client>
  </system.serviceModel>
  <appSettings>
    <!-- Service Bus specific app setings for messaging connections -->
    <add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://[your namespace].servicebus.windows.net;SharedSecretIssuer=owner;SharedSecretValue=[your secret]" />
  </appSettings>
</configuration>

一段时间以来,我一直在用头撞墙,试图找出可能出了什么问题。美好的一天半,除了谷歌搜索之外什么都没有。我尝试过编辑 machine.config,但我尝试了很多不同的东西。到目前为止,没有任何工作。知道可能是什么问题吗?

【问题讨论】:

    标签: .net azure appfabric


    【解决方案1】:

    确保在定义NetTcpRelayBinding class 的项目中引用Microsoft.ServiceBus 程序集。

    【讨论】:

      【解决方案2】:

      您需要添加一个名为 MYnetTcpRelayBinding 的绑定:

      <bindings>
        <netTcpRelayBinding>
          <binding name="netTcpRelayBinding" ....
      

      并更改您的端点以使用该绑定:

      <client>
            <endpoint address="" binding="MYnetTcpRelayBinding" ...
      

      【讨论】:

        猜你喜欢
        • 2013-08-16
        • 2013-09-10
        • 1970-01-01
        • 1970-01-01
        • 2011-04-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多