gpt4 book ai didi

ssl - 为什么在作为 Windows 服务托管的休息服务上添加基于证书的身份验证,无法启动服务?

转载 作者:太空宇宙 更新时间:2023-11-03 12:49:35 25 4
gpt4 key购买 nike

我已经创建了 WCF REST 服务并托管为 Windows 服务。我引用了以下帖子。

http://www.codeproject.com/Tips/1009004/WCF-RESTful-on-Windows-Service-Host

现在我正在尝试在其上添加基于证书的身份验证。

我在配置文件中添加了以下部分。注意:我按照以下 msdn 链接添加身份验证 https://msdn.microsoft.com/en-us/library/ff648360.aspx

<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security>
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>

 <serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<serviceCertificate findValue="CN=tempCertServer" />
</serviceCredentials>
</behavior>
</serviceBehaviors>

我安装了 Windows 服务并尝试启动它。它会抛出错误。

enter image description here

我删除了以下部分

<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<serviceCertificate findValue="CN=tempCertServer" />
</serviceCredentials>
</behavior>
</serviceBehaviors>

错误消失。显然认证没有用。

可能是什么原因?我是否正确地为托管为 Windows 服务的其余服务添加了基于证书的身份验证?

最佳答案

I got the solution.I made following change 

<serviceDebug includeExceptionDetailInFaults="true" />
I saw the exception in event view logs. service was not able to find certificate,
hence not started.Again created certificate and it works.
For creating certificate follow following link closely.

https://msdn.microsoft.com/en-us/library/ff648498.aspx

关于ssl - 为什么在作为 Windows 服务托管的休息服务上添加基于证书的身份验证,无法启动服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40528181/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com