【发布时间】:2015-02-24 13:49:12
【问题描述】:
我正在尝试通过 http 和 https 托管 WCF 服务并使用以下配置:
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITestService">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpsBinding_ITestService">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
<message />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TestService" behaviorConfiguration="TestServiceBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/"/>
<add baseAddress="https://localhost:8083/"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService"
contract="ITestService" name="BasicHttpsBinding_ITestService" />
<endpoint address=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_ITestService"
contract="ITestService" name="BasicHttpsBinding_ITestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TestServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
但我收到以下错误: 找不到与绑定 BasicHttpBinding 的终结点的方案 https 匹配的基地址。注册的基地址方案是 [http]。
需要一个解决方案,因为我已经为 http 和 https 定义了基地址和绑定。
谢谢。
【问题讨论】: