没有端点侦听WCF AuthenticationService

没有端点侦听WCF AuthenticationService,wcf,windows-phone-7,ssl,wcf-ria-services,wcf-security,Wcf,Windows Phone 7,Ssl,Wcf Ria Services,Wcf Security,我正在尝试使用windows phone 7对我的用户登录进行身份验证 AuthenticationService WCF托管在IIS 7中 <services> <service behaviorConfiguration="AppServiceBehaviors" name="System.Web.ApplicationServices.AuthenticationService"> <endpoint

我正在尝试使用windows phone 7对我的用户登录进行身份验证 AuthenticationService WCF托管在IIS 7中

        <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"/>
我在没有SSL的情况下尝试过,效果很好。但我想把它转换成 https

        <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"/>
我得到的错误是当我从WP7模拟器调用这个WCF时 是:

        <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"/>
但是,my 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>
        <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"/>

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

根据@Rajesh的评论,我在手机中安装了证书,它开始工作

        <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"/>
我尝试了导出.CER、.PFX和.P7B格式的所有选项,只有P7B格式适合我,才能将其安装到手机中

        <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"/>
web.config文件中用于启用带SSL的AuthenticationService WCF的部分为

        <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"/>

        <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代理通过DNS、WINS、, 主机文件等
  • SSL证书的名称必须与主机名称匹配 名字
  • 受信任的根证书必须与http一起安装
    探员,就是在电话里
在WP7仿真器手机上安装证书是最棘手的部分。如前所述,P7B文件托管在IIS上,URL通过emulator浏览器访问,这有助于我在手机上安装证书(对不起!我忘记了参考链接)

        <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"/>
安装后,端点问题消失,并开始工作。由于这不是一个永久性的解决方案(因为每次emulator关闭时都需要重新安装证书),因此我正在编写代码,以便在IIS中托管证书进行测试时使其正常工作

        <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"/>

感谢@Rajesh的帮助。

如果您在IIS上托管,则终结点地址由IIS管理,因此请删除终结点地址值。我还看到您在端口700上使用Https,而不是默认的443。如果这是您想要的,那么请将SSL证书映射到IIS中的端口700。证书是自签名的吗?如果是,则您可能会得到一个异常,该异常可由ServicePointManager.ServerCertificateValidationCallback属性()覆盖是其自签名以及在何处使用此ServicePointManager.ServerCertificateValidationCallback??在Wp7中,所有的都是异步webservice调用,我不知道该放在哪里。我也使用默认443进行了尝试。ServicePointManager.ServerCertificateValidationCallback需要在客户端调用代码。@Rajesh我将其更改为默认端口443,但仍然显示相同的错误。您是否可以使用IE或某些浏览器在远程主机上本地浏览?
        <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"/>