Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF-来自web应用程序的基于证书的授权_C#_Asp.net_Wcf_Certificate - Fatal编程技术网

C# WCF-来自web应用程序的基于证书的授权

C# WCF-来自web应用程序的基于证书的授权,c#,asp.net,wcf,certificate,C#,Asp.net,Wcf,Certificate,我有一个WCF服务,只有少数拥有已知证书的机器和一个web应用程序可以访问该服务 对于web应用,我需要指定用于授权的证书: <behaviors> <endpointBehaviors> <behavior name="ScannerManagerBehavior"> <clientCredentials> <clientCertificate findValue="MyCertificateName

我有一个WCF服务,只有少数拥有已知证书的机器和一个web应用程序可以访问该服务

对于web应用,我需要指定用于授权的证书:

<behaviors>
  <endpointBehaviors>
    <behavior name="ScannerManagerBehavior">
      <clientCredentials>
        <clientCertificate findValue="MyCertificateName" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My"/>
        <serviceCertificate>
          <authentication certificateValidationMode="PeerTrust"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>

问题是web应用程序没有在注册证书的用户帐户下运行。为了在开发模式下解决这个问题,我将应用程序池更改为以我的用户身份运行,但这是一个临时设置。解决方案

我应该为“网络服务”用户帐户安装证书(如果可以),为证书指定其他来源,还是有更好的方法解决此问题


谢谢

将证书安装在LocalMachine存储中而不是当前用户存储中-然后可以通过更改clientCertificate元素中的storeLocation从那里获取证书