WCF 中的 netTCP 证书无效

发布于 2024-10-19 10:05:12 字数 709 浏览 2 评论 0原文

我正在尝试让我的 WCF 服务在本地环境中使用基于证书的加密,以便在实际环境中时它可以与不同域中的计算机进行通信。在尝试实施安全性之前,我已经让服务完美运行,因此我确信故障不在服务中。

我使用 makecert.exe 生成了一些证书。首先,我创建了两个,分别称为 WCFclient 和 WCFServer,并将它们添加到 mmc 中当前用户的受信任文件夹中。然而,这产生了错误:

传出身份验证失败 信息。预期的 DNS 身份 远程端点是“localhost” 但远程端点提供了 DNS 声明“WCFServer”。如果这是一个 合法的远程端点,您可以 通过明确地解决问题 将 DNS 身份“WCFServer”指定为 的身份属性 创建通道时的端点地址 代理

是因为我将证书颁发给一个名为“WCFServer”的不存在的域。因此,我创建了另一个证书,并给它一个 CN“localhost”,并尝试配置客户端和服务器来使用它。现在我收到这条消息:

根据验证程序,远程证书无效。

我在客户端配置中设置了certificateValidationMode =“None”,所以我认为这不是由于证书过期或类似原因造成的。有谁知道还有什么可能导致此错误?是否因为我试图在客户端和服务器端使用相同的证书,如果是这样,我如何设置配置文件以避免获取先前有关 DNS 身份的错误消息?

I'm trying to get my WCF service to use certificate-based encryption in my local environment so that it'll talk to machines in different domains when its out in the live environment. I had the service working perfectly before trying to implement security, so I'm confident the fault isn't in the service.

I generated some certificates using makecert.exe. To start with I created two that I just called WCFclient and WCFServer and I added them to the trusted folder for current user in mmc. However that yielded the error:

Identity check failed for outgoing
message. The expected DNS identity of
the remote endpoint was 'localhost'
but the remote endpoint provided DNS
claim 'WCfServer'. If this is a
legitimate remote endpoint, you can
fix the problem by explicitly
specifying DNS identity 'WCfServer' as
the Identity property of
EndpointAddress when creating channel
proxy

Which I figured occured because I was issuing my certificate to a non-existent domain called "WCFServer". So I created another cert and gave it a CN of "localhost" and tried to configure both client and server to use it. Now I'm getting this message:

The remote certificate is invalid according to the validation procedure.

I've set certificateValidationMode="None" in my client config, so I don't think this is due to an expired certificate or suchlike. Does anyone know what else might be causing this error? Is it because i'm trying to use the same cert on both client and server ends, and if so how do I set the config files to avoid getting the previous error message about the DNS identity?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与君绝 2024-10-26 10:05:12

通过使用以下客户端端点定义可以避免前面的错误消息:

<endpoint  name="..." address="..." binding="..." contract="...">
  <identity>
    <dns value="WCFServer" />
  </identity>
</endpoint>

对于第二个错误,使用 PeerTrust 验证模式就足够了。

The previous error message can be avoided by using following definition of client endpoint:

<endpoint  name="..." address="..." binding="..." contract="...">
  <identity>
    <dns value="WCFServer" />
  </identity>
</endpoint>

For second error it should be enough to use PeerTrust validation mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文