gpt4 book ai didi

wcf - 元素 'behavior' 具有无效的子元素 'transportClientEndpointBehavior' 也是 basicHttpRelayBinding

转载 作者:行者123 更新时间:2023-12-04 23:46:47 26 4
gpt4 key购买 nike

创建 WCF 配置文件时,我可能会在 Visual Studio 中遇到此错误,因为 VS 编辑器不知道该扩展名。我需要知道在哪里放置 TransportClientEndpointBehavior,有什么帮助吗?谢谢。

 <behaviors>
<endpointBehaviors>
<behavior name="sharedSecretClientCredentials">
<transportClientEndpointBehavior credentialType="SharedSecret">
<clientCredentials>
<sharedSecret issuerName="***********" issuerSecret="**********" />
</clientCredentials>
</transportClientEndpointBehavior>
<ServiceRegistrySettings discoveryMode="Public"/>
</behavior>
</endpointBehaviors>
...
</behaviors>

我也有 basicHttpRelayBinding 的问题,我想它包含在绑定(bind)下。

最佳答案

Windows Azure 平台培训工具包中有一个以编程方式执行此操作的示例。这是示例片段...

// create the service URI based on the service namespace
Uri address = ServiceBusEnvironment.CreateServiceUri("sb",
serviceNamespaceDomain, "EchoService");

// create the credential object for the endpoint
TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();
sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// create the service host reading the configuration
ServiceHost host = new ServiceHost(typeof(EchoService), address);

// create the ServiceRegistrySettings behavior for the endpoint
IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);

// add the Service Bus credentials to all endpoints specified in configuration
foreach (ServiceEndpoint endpoint in host.Description.Endpoints)
{
endpoint.Behaviors.Add(sharedSecretServiceBusCredential);
}

// open the service
host.Open();

关于wcf - 元素 'behavior' 具有无效的子元素 'transportClientEndpointBehavior' 也是 basicHttpRelayBinding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5156738/

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