我正在尝试制作一个侦听服务总线的 WCF 应用程序。以下用于在 Web.config 中定义服务的代码段在设置为时multipleSiteBindingsEnabled
有效false
:
<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 注册为方案,我还需要为该服务声明什么吗?请注意,我确实将绑定的安全模式设置为传输。