【问题标题】:There was no end point listening for WCF AuthenticationService没有监听 WCF AuthenticationService 的端点
【发布时间】:2012-10-25 13:29:13
【问题描述】:

我正在尝试使用 windows phone 7 验证我的用户登录 AuthenticationService WCF 托管在 IIS 7 中。

我在没有 SSL 的情况下尝试过,并且工作正常。但我想将其转换为 https。

我得到的错误是当我从我的 WP7 模拟器中调用这个 WCF 时 是:

"EndpointNotFoundException"

但是我的 web.config 有以下详细信息:

<system.serviceModel>
   <services>
     <service name="System.Web.ApplicationServices.AuthenticationService" 
    behaviorConfiguration="AuthenticationServiceTypeBehaviors">
       <endpoint contract="System.Web.ApplicationServices.AuthenticationService"  
         binding="basicHttpBinding"
         bindingConfiguration="userHttps" address="https://localhost:700/AuthenticationService.svc"
         bindingNamespace="http://asp.net/ApplicationServices/v200"/>
       <endpoint address="mex" 
      binding="mexHttpsBinding"
      contract="IMetadataExchange" /> 
     </service>

   </services>
   <bindings>
     <basicHttpBinding>
       <binding name="userHttps">
         <security mode="Transport">
           <transport clientCredentialType="None" />
         </security>
       </binding>
     </basicHttpBinding>
   </bindings>
   <behaviors>
     <serviceBehaviors>
       <behavior name="AuthenticationServiceTypeBehaviors" >
         <serviceMetadata httpsGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="true"  />
       </behavior>

     </serviceBehaviors>

   </behaviors>
   <serviceHostingEnvironment
     aspNetCompatibilityEnabled="true"/>
 </system.serviceModel>

使用:AspNetSqlMembershipProvider,我避免使用这些细节来说明这一点。

在我的 IIS 7 中,我创建了一个应用程序池并关联了一个自签名 托管 WCF 的证书,并在 SSL 设置选项中选择“需要 SSL - 选中”和“忽略客户端证书 - 选中”

我可以浏览到https://localhost:700/AuthenticationService.svc.

我可以将此作为服务参考添加到我的手机中,但是当我致电 登录方法显示错误。

我已经指定了终点地址,但它仍然显示错误。

谁能解释我如何调试它以获取更多详细信息或任何指向 解决“通过 SSL 使用身份验证服务 WCF”

EDIT 1 我在尝试访问时尝试使用 IP 地址和 svc URL 通过浏览器服务

svcutil.exe https://mcname.domain.local:700/AuthenticationService.svc?wsdl 

EDIT 2尝试禁用防病毒和防火墙,但仍然没有成功。

【问题讨论】:

  • 如果您在 IIS 上托管,则端点地址由 IIS 管理,因此删除端点地址值。我还看到您在端口 700 上使用 Https 而不是默认的 443。如果这是您想要的,那么您是否将 SSL 证书映射到 IIS 中的端口 700。证书是自签名的吗?如果是,那么您可能会得到一个可以被 ServicePointManager.ServerCertificateValidationCallback 属性覆盖的异常 (msdn.microsoft.com/en-us/library/…)
  • 是的,它的自签名以及在哪里使用这个 ServicePointManager.ServerCertificateValidationCallback??在 Wp7 中,它都是异步 Web 服务调用,我不知道该放在哪里。我也用默认的 443 试过了
  • ServicePointManager.ServerCertificateValidationCallback 需要在客户端调用代码。
  • @Rajesh 我将其更改为默认端口 443,但仍然显示相同的错误
  • 你能在remotehost机器上用IE或其他浏览器在本地浏览吗?

标签: wcf windows-phone-7 ssl wcf-ria-services wcf-security


【解决方案1】:

根据@Rajesh 的 cmets,我在手机中安装了证书并开始工作。

我尝试了所有导出 .CER、.PFX 和 .P7B 格式的选项,但只有 P7B 格式对我有用,才能将其安装到手机中。

使用 SSL 启用 AuthenticationService WCF 的 web.config 文件部分是

        <services>
          <service behaviorConfiguration="AppServiceBehaviors" name="System.Web.ApplicationServices.AuthenticationService">
            <endpoint binding="basicHttpBinding" bindingConfiguration="defaultBasicHttpBinding"
              bindingNamespace="http://asp.net/ApplicationServices/v200" contract="System.Web.ApplicationServices.AuthenticationService" />
          </service>

        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="AppServiceBehaviors">
              <serviceMetadata httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
            <behavior name="">
              <serviceMetadata httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

      <system.web.extensions>
        <scripting>
          <webServices>
            <authenticationService enabled="true" requireSSL="true"/>

使其工作的步骤:http://blogs.msdn.com/b/davidhardin/archive/2010/12/30/wp7-and-self-signed-ssl-certificates.aspx

  • 主机名必须可由 http 代理通过 DNS、WINS、 主机文件等。
  • SSL 证书的名称必须与主机匹配 姓名。
  • 受信任的根证书必须与 http
    一起安装 代理,即在电话上。

在 WP7 模拟器手机上安装证书是最棘手的部分。如前所述,P7B 文件托管在 IIS 上,并且通过模拟器浏览器访问 URL,这有助于我在手机上安装证书(对不​​起!我忘记了参考链接)。

安装后,端点问题消失并开始工作。由于这不是一个永久的解决方案(因为每次关闭模拟器时都需要重新安装 CERT),我正在编写 http://wp7certinstaller.codeplex.com/ 代码以使其在托管在 IIS 中以进行测试时工作。

感谢@Rajesh 的帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多