【发布时间】:2011-04-13 11:42:21
【问题描述】:
我正在尝试使用身份验证服务和我的成员资格提供程序进行身份验证。理想情况下,我想打电话给我的会员提供商,但我在打到我的提供商之前就崩溃了。表示无法验证令牌。检查我的错误日志,看来我正在尝试使用 Windows auth 进行身份验证。那不是我打算做的。这是一个带有 svc 文件的网站。我使用 svcUtil 并从 WSDL 生成客户端。我在使用客户端的应用程序中有一个测试页面。它只是一个测试页面,不会被部署。我看到在 IIS 中检查了集成 Windows 身份验证,这似乎不正确,但如果我取消选中它,Visual Studio 将不会调试。无论如何,我查看事件日志并得到两个错误
Logon Failure:
Reason: Unknown user name or bad password
User Name: sandagtestuser
Domain:
Logon Type: 8
Logon Process: Advapi
Authentication Package: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Workstation Name: SDD-CK
Logon attempt by: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Logon account: sandagtestuser
Source Workstation: SDD-CK
Error Code: 0xC0000064
这是 web.config 中的绑定。请注意,我正在尝试使用 SSL 和 HTTPS。这是我第一次尝试 WCF 安全性
<system.serviceModel>
<client>
<endpoint address="https://SDD-CK/ATISServices/Services/AuthService.svc/AuthService"
binding="basicHttpBinding" bindingConfiguration="userHttps_AuthenticationService"
contract="AuthenticationService" name="userHttps_AuthenticationService" >
</endpoint>
</client>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<serviceBehaviors>
<behavior name="ATISServices.AuthServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="userHttps_AuthenticationService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport proxyCredentialType="None" clientCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="basic_auth_config">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ATISServices.AuthServiceBehavior"
name="System.Web.ApplicationServices.AuthenticationService">
<endpoint binding="basicHttpBinding" bindingName="userHttps" bindingConfiguration="basic_auth_config"
bindingNamespace="http://asp.net/ApplicationServices/v200"
contract="System.Web.ApplicationServices.AuthenticationService"
address="AuthService"/>
<endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration=""
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
也许一些 WCF 专家可以帮助我解决问题。我看到凭据通过事件日志到达服务器,所以我不能离得太远。故障上的实际 InnerException 消息是 At least one security token in the message could not be validated.
最后是一些可能感兴趣的附加 web.config 设置。
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL="true"/>
</webServices>
</scripting>
</system.web.extensions>
<authentication mode="Forms" >
<forms cookieless="UseCookies" />
</authentication>
<membership defaultProvider="KCMembershipProvider">
<providers>
<clear/>
<add
name="KCMembershipProvider"
applicationName="/"
type="zcore.MembershipProvider.KCMembershipProvider, zcore.MembershipProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</providers>
</membership>
在这一点上的任何帮助或提示将不胜感激。我已经为此奋斗了两天。我也在使用证书。我用'makecert'工具制作了它们。一个是证书颁发机构,另一个是使用所述颁发机构的“本地主机”证书。我还使用了 httpcfg 并将证书指纹设置为端口 9307,但是当我在服务地址上放置“:9307”时,我会主动拒绝连接。我真的很感谢这里的任何帮助。
干杯,
~ck 在圣地亚哥
【问题讨论】:
标签: asp.net wcf authentication forms-authentication membership-provider