将multipleSiteBindingsEnabled设置为true时如何设置WCF应用程序

时间:2013-01-09 22:41:37

标签: wcf servicebus webhttprelaybinding

我正在尝试创建一个侦听Service Bus的WCF应用程序。当multipleSiteBindingsEnabled设置为false时,以下用于在Web.config中定义服务的代码段有效:

  <service behaviorConfiguration="MyServiceTypeBehavior"
    name="WcfService3.Service1">
    <endpoint address="https://namespace.servicebus.windows.net/WebHttpService"
    behaviorConfiguration="sharedSecretClientCredentials"
    binding="webHttpRelayBinding"
    bindingConfiguration="WebHttpRelayEndpointConfig"
    name="RelayEndpoint"
    contract="WcfService3.IService1"/>
  </service>

multipleSiteBindingsEnabled设置为true时,我将配置更改为以下内容:

  <service behaviorConfiguration="MyServiceTypeBehavior"
    name="WcfService3.Service1">
    <host>
      <baseAddresses>
        <add baseAddress="https://namespace.servicebus.windows.net/" />
      </baseAddresses>
    </host>
    <endpoint address="WebHttpService"
    behaviorConfiguration="sharedSecretClientCredentials"
    binding="webHttpRelayBinding"
    bindingConfiguration="WebHttpRelayEndpointConfig"
    name="RelayEndpoint"
    contract="WcfService3.IService1"/>
  </service>

这会导致以下错误: Could not find a base address that matches scheme https for the endpoint with binding WebHttpRelayBinding. Registered base address schemes are [http].

我还需要为服务声明什么,以便将https注册为方案吗?请注意,我确实将绑定的安全模式作为传输。

1 个答案:

答案 0 :(得分:1)

将multipleSiteBindingsEnabled设置为true将与使用中继端点不兼容。这是因为中继端点需要端点配置(服务总线中继端点)上的绝对地址,而multipleSiteBindingsEnabled需要具有相对地址的端点才能工作。

您想通过将multipleSiteBindingsEnabled设置为true来完成什么?