gpt4 book ai didi

azure - 命名空间中的多个中继端点用于通过服务总线公开服务?

转载 作者:行者123 更新时间:2023-12-03 00:16:54 25 4
gpt4 key购买 nike

我无法激活由同一命名空间中的两个不同中继端点公开但具有不同地址的服务。如果我删除其中之一,服务就会正常激活,因此配置就很好。我尝试更改绑定(bind)的类型,更改命名空间,添加两个行为配置而不是仅一个,但我总是得到相同的错误(在底部)。

有人知道我是否遗漏了什么吗?我可以在同一命名空间中拥有两个中继端点吗?

<service name="Service">    
<endpoint contract="IService" binding="basicHttpRelayBinding" name="b1 "
address="http://**NAMESPACE**.servicebus.windows.net/s1" behaviorConfiguration="credentials"/>
<endpoint contract="IService" binding="webHttpRelayBinding" name="wh1"
address="https://**NAMESPACE**.servicebus.windows.net/s2" behaviorConfiguration="credentials"/>
</service>
<behavior name="credentials">
<serviceRegistrySettings discoveryMode="Public" displayName="Auxiliar" />
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="**KEY**" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>

错误是:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.ArgumentException: The value could not be added to the collection, as the collection already contains an item of the same type: 'Microsoft.ServiceBus.NameSettings'. This collection only supports one instance of each type. Parameter name: item at System.Collections.Generic.KeyedByTypeCollection1.InsertItem(Int32 index, TItem item)
at Microsoft.ServiceBus.ServiceRegistrySettings.System.ServiceModel.Description.IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
at System.ServiceModel.Description.DispatcherBuilder.AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection parameters)
at System.ServiceModel.Description.DispatcherBuilder.GetBindingParameters(ServiceHostBase serviceHost, Collection
1 endpoints) at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata() at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized() at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension) at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData() at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage) at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest) at SyncInvokeGet(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

最佳答案

您发现的问题是 /behavior/serviceRegistrySettings/@displayName两个服务定义发生冲突。如果您想要控制每个端点的 displayName,那么您需要创建单独的命名行为。复制端点契约(Contract)时,您需要确保显示名称是唯一的。

选项#1 - 删除displayName

   <behavior name="credentials">
<serviceRegistrySettings discoveryMode="Public" />
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="**KEY**" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>

选项#2 - 创建重复的行为配置

   <service name="Service">    
<endpoint contract="IService" binding="basicHttpRelayBinding" name="b1 "
address="http://**NAMESPACE**.servicebus.windows.net/s1" behaviorConfiguration="basicCredentials"/>
<endpoint contract="IService" binding="webHttpRelayBinding" name="wh1"
address="https://**NAMESPACE**.servicebus.windows.net/s2" behaviorConfiguration="webHttpCredentials"/>
</service>
<behavior name="basicCredentials">
<serviceRegistrySettings discoveryMode="Public" displayName="AuxiliarBasic"/>
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="**KEY**" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>
<behavior name="webHttpCredentials">
<serviceRegistrySettings discoveryMode="Public" displayName="AuxiliarWebHttp"/>
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="**KEY**" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>

关于azure - 命名空间中的多个中继端点用于通过服务总线公开服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12265822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com