【发布时间】:2015-09-09 07:16:45
【问题描述】:
我已经创建了一个 WCF 身份验证服务并且一切正常。当我尝试对通信实施 SSL 加密时,出现以下错误:
https://myDomain/WebSite/MyAuthenticationSvcWrap.svc 上没有积极收听的频道。这通常是由不正确的地址 URI 引起的。确保消息发送到的地址与服务正在侦听的地址匹配。
http服务主机的web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="AppServiceBehaviors" name="WebSite.System.Web.ApplicationServices.AuthenticationService">
<endpoint binding="basicHttpBinding" bindingConfiguration="Binding1" bindingNamespace="http://asp.net/ApplicationServices/v200" contract="WebSite.System.Web.ApplicationServices.AuthenticationService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="Binding1" >
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="AppServiceBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
和客户端 app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_AuthenticationService">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mydomain/WebSite/MyAuthenticationSvcWrap.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AuthenticationService"
contract="AuthenticationService" name="BasicHttpBinding_AuthenticationService" />
</client>
</system.serviceModel>
https 服务主机:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="AppServiceBehaviors" name="WebSite.System.Web.ApplicationServices.AuthenticationService">
<endpoint binding="basicHttpBinding" bindingConfiguration="Binding1" bindingNamespace="http://asp.net/ApplicationServices/v200" contract="WebSite.System.Web.ApplicationServices.AuthenticationService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="Binding1" >
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="AppServiceBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
和客户端的app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_AuthenticationService">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://mydomain/WebSite/MyAuthenticationSvcWrap.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AuthenticationService"
contract="AuthenticationService" name="BasicHttpBinding_AuthenticationService" />
</client>
</system.serviceModel>
实际上我已经在两个文件的basicHttpBinding中将元素的mode属性更改为Transport,并且还将客户端端点地址从http更改为https。我还必须在这里注意,通过在浏览器中点击https://mydomain/WebSite/MyAuthenticationSvcWrap.svc 可以找到该页面并获得响应。
谁能指出为什么会发生这种行为?
非常感谢
【问题讨论】: