Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.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
帮助在.net上设置wsHttpBinding WCF服务_.net_Wcf_Web Services_Certificate_Wshttpbinding - Fatal编程技术网

帮助在.net上设置wsHttpBinding WCF服务

帮助在.net上设置wsHttpBinding WCF服务,.net,wcf,web-services,certificate,wshttpbinding,.net,Wcf,Web Services,Certificate,Wshttpbinding,我正在尝试使用wsHttpBinding托管WCF服务。我使用makecert创建了一个证书,并在web.config中添加了一些行 这是我得到的错误: System.ArgumentException: The certificate 'CN=WCfServer' must have a private key that is capable of key exchange. The process must have access rights for the private key. 在

我正在尝试使用wsHttpBinding托管WCF服务。我使用makecert创建了一个证书,并在web.config中添加了一些行

这是我得到的错误:

System.ArgumentException: The certificate 'CN=WCfServer' must have a private key that is capable of key exchange. The process must have access rights for the private key.
在谷歌上搜索时,证书文件的访问权限似乎出现了一些问题。我使用cacls为网络服务和我的用户名授予读取权限,但它并没有改变任何东西

我还访问了证书文件属性中的安全设置,并完全控制了网络服务和我的用户名。还是没用

你能告诉我问题是什么,我到底需要做什么吗?我对这些证书的东西真的很挑剔

这是我的web.config:

<system.serviceModel>

<services>
        <service name="Abc.Service" behaviorConfiguration="Abc.ServiceBehavior">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Abc.BindConfig" contract="Abc.IService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>

<behaviors>
    <serviceBehaviors>
        <behavior name="Abc.ServiceBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="false"/>

            <serviceCredentials>
                <clientCertificate>
                  <authentication certificateValidationMode="PeerTrust"/>
                </clientCertificate>
                <serviceCertificate findValue="WCfServer" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
            </serviceCredentials>

        </behavior>
    </serviceBehaviors>
</behaviors>

<bindings>
  <wsHttpBinding>
    <binding name="Abc.BindConfig">
      <security mode="Message">
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

</system.serviceModel>

从我从网上收集到的信息来看,这似乎不是权限问题,更像是证书的配置有问题

有关于如何允许访问私钥的说明


您是否已安装并运行IIS7。有一个用于创建证书(而不是makecert)的方法,我已成功地将其用于WCF通信。

从我从web上收集的信息来看,这似乎不是权限问题,更像是证书的配置有问题

有关于如何允许访问私钥的说明

您是否已安装并运行IIS7。这里有一个用于创建证书(而不是makecert)的工具,我已成功地将其用于WCF通信。

请查看。它允许向Windows帐户授予对X.509证书私钥的访问权限

这说明了如何使用该工具。

请查看。它允许向Windows帐户授予对X.509证书私钥的访问权限


这说明了如何使用该工具。

好的。。我知道问题出在哪里了。使用makecert创建证书时,必须使用-pe选项,使生成的私有文件可导出,以便在证书中使用。问题是与vs2008 is版本5.131捆绑在一起的makecert没有-pe选项。我在MicrosoftSDK6中找到了版本6.0,它有这个选项


这是我在.net初学者中发现的最大问题。同样的东西有很多不兼容的版本,当你在互联网上查找资料时,你不知道别人在谈论哪个版本。

好的。。我知道问题出在哪里了。使用makecert创建证书时,必须使用-pe选项,使生成的私有文件可导出,以便在证书中使用。问题是与vs2008 is版本5.131捆绑在一起的makecert没有-pe选项。我在MicrosoftSDK6中找到了版本6.0,它有这个选项

这是我在.net初学者中发现的最大问题。同样的东西有很多不兼容的版本,当你在互联网上查找资料时,你不知道别人在谈论哪个版本