none
WCF The credentials supplied to the package were not recognized RRS feed

  • 问题

  • 使用了宿主成Windows Service的WCF,客户端是一个Web Application,通过TCP/IP来使用这个服务,通过证书来验证客户端。
    现在在开发环境运行很好。但是部署到产品环境后,服务可以启动,客户端却不能调用这个服务了。抛出如下异常。

    The credentials supplied to the package were not recognized。


    客户端的配置(节选):
    <endpoint address="net.tcp://100.50.0.9:1234/EmployeeInfoService" binding="netTcpBinding" behaviorConfiguration="SecurityBehavior" bindingConfiguration="SecurityBind" contract="A.IEmployeeInfo" name="IEmployeeInfo">
    <identity>
    <dns value="Server"> </dns>
    </identity>
    </endpoint>
    <endpointBehaviors>
          <behavior name="SecurityBehavior">
      <clientCredentials>
    <clientCertificate findValue="Client" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
    <serviceCertificate>
    <authentication certificateValidationMode="None" />
    </serviceCertificate>
      </clientCredentials>
          </behavior>
    </endpointBehaviors>
    <binding name="SecurityBind" >
    <security mode="Transport">
    <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
    <message clientCredentialType="Windows" />
    </security>
    </binding>
    2009年4月22日 12:04

答案

全部回复

  • Hi,
      如果你使用了服务器证书来验证客户端。
      你测试时候是不是在单机测试的?
      这个问题应该是安全验证出错。
      你需要把证书导出,在客户端设置这个证书为信任的证书。
      不然会出错。
    Frank.Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    老徐的博客:http://frank_xl.cnblogs.com
    2009年7月29日 4:32
    版主
  • 这里WCF英文论坛有个一样的问题解决了,参考一下:

    Have identified the cause of the problem.

    When the server certificate was imported into the certificate store "enable strong name key protection" was checked. As a result, each time the WCF service tried to access the private key it was getting prompted for a password in the background.

    To get around it, I logged in as the user that the WCF service was running under, imported the certificate into the Local Machine\My store, then copied into the Current User\My store for that user account.

    Very annoying.

    http://social.msdn.microsoft.com/Forums/en/wcf/thread/75668920-eca5-4a23-bc96-2105f42cab72


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    微软WCF中文技术论坛
    微软WCF英文技术论坛

    Windows Azure中文技术论坛

    2011年4月2日 2:25
    版主