【发布时间】:2012-12-04 07:52:36
【问题描述】:
我通过服务总线公开我的 windows 服务,下面是我的配置文件。 我收到奇怪的错误(它突然开始出现,虽然代码/配置没有变化。它之前工作正常。
One23InsightService 无法启动。异常消息:-无法将值添加到集合中,因为集合已包含相同类型的项目:“Microsoft.ServiceBus.TransportClientEndpointBehavior”。此集合仅支持每种类型的一个实例。 参数名称:项目 我有两个具有不同接口但行为配置相同的端点。
<system.serviceModel>
<services>
<service name="One234C.Service.WCFNetTCPContract.InsightSrcDataService">
<endpoint
name="SrcWeb"
address="sb://xxx.servicebus.windows.net/09C3FA14-D449-4EA0-A829-3B7BD06598C2"
binding="netTcpRelayBinding"
contract="One234C.Service.Interface.IOne23SrcService"
bindingConfiguration="Hybrid"
behaviorConfiguration="sbTokenProvider" />
<endpoint
name="AdminServiceEndpoint"
address="sb://xxx.servicebus.windows.net/09C3FA14-D449-4EA0-A829-3B7BD06598C2"
binding="netTcpRelayBinding"
contract="One234C.Service.AdminInterface.IOne23AdminService"
bindingConfiguration="Hybrid"
behaviorConfiguration="sbTokenProvider" />
</service>
</services>
<bindings>
<netTcpRelayBinding>
<binding name="Hybrid" connectionMode="Hybrid" maxReceivedMessageSize="500000">
<security mode="None" />
</binding>
</netTcpRelayBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="False" httpsGetEnabled="False" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="sbTokenProvider">
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="asdfadfdfasdfasdfasdfsadfsadfsadfsdaf=" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>
</endpointBehaviors>
</behaviors>
<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>
</system.serviceModel>
【问题讨论】:
-
您是否尝试过创建一种新行为并将其分配给一个或其他端点?
-
@hugh 是的,我也试过了。它没有解决我的问题。我创建了它的安装程序,它可能与注册表损坏有关吗?
-
它是否只适用于配置中的单个端点?
-
@hugh 是的,一个端点可以正常工作。但是我需要两个端点,请问有没有其他方法可以配置它。
-
@hugh 我得到了修复,我给两个端点提供了相同的地址,它一定是不同的,我更正了,它现在可以工作了。谢谢休。
标签: wcf wcf-configuration azureservicebus