WCF AuthenticationService.IsLoggedIn问题

时间:2010-11-22 09:40:25

标签: c# asp.net wcf authentication

我为auth例程使用单独的WCF AuthenticationService。方法:ValidateUser,Login返回true,所以看起来一切正常,但是当我在使用Login()方法后调用IsLoggedIn()时,它返回false。

AuthService设置:

 <?xml version="1.0"?>
 <configuration>




    <connectionStrings>
     <clear />
    <add name="LocalMySqlServer" connectionString="server=192.168.0.7;Database=clients;       uid=clients;pwd=fetisova;persist security info=True;CharSet=utf8;         Use Procedure Bodies =false;" providerName="MySql.Data.MySqlClient" />
     </connectionStrings>


<system.web>
<machineKey validation="SHA1" />
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms" >
  <forms cookieless="UseCookies" />
</authentication>

<membership defaultProvider="MySQLMembershipProvider">
    <providers>
      <clear />
      <add name="MySQLMembershipProvider" 
           type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 
           connectionStringName="LocalMySqlServer" 
           enablePasswordRetrieval="false" 
           enablePasswordReset="true" 
           requiresQuestionAndAnswer="false" 
           applicationName="Clients" 
           requiresUniqueEmail="false" 
           passwordFormat="Hashed" 
           maxInvalidPasswordAttempts="500" 
           minRequiredPasswordLength="3" 
           minRequiredNonalphanumericCharacters="0" 
           passwordAttemptWindow="10" 
           passwordStrengthRegularExpression="" />
    </providers>
  </membership>
  <roleManager defaultProvider="MySQLRoleProvider" enabled="true">
    <providers>
      <clear />
      <add name="MySQLRoleProvider" 
           connectionStringName="LocalMySqlServer" 
           applicationName="Clients" 
           type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </providers>
  </roleManager>
    </system.web>
   <system.web.extensions>
<scripting>
  <webServices>
    <authenticationService enabled="true"/>
  </webServices>
</scripting>
 </system.web.extensions>
 <system.serviceModel>
<services>
  <service name="System.Web.ApplicationServices.AuthenticationService"
      behaviorConfiguration="AuthenticationServiceTypeBehaviors">
    <endpoint contract=
    "System.Web.ApplicationServices.AuthenticationService"
      binding="basicHttpBinding"
      bindingConfiguration="userHttps"
      bindingNamespace="http://asp.net/ApplicationServices/v200"/>
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="userHttps">
      <security mode="None" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="AuthenticationServiceTypeBehaviors">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug
        httpHelpPageEnabled="true"
        includeExceptionDetailInFaults="true"
      />

    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
  aspNetCompatibilityEnabled="true"/>

       

那有什么不对?你可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我应该在客户端

设置allowCookie =“true”