使用无效的 SSL 证书从 WSDL 生成服务代理时出现问题

发布于 2024-10-05 20:55:02 字数 2157 浏览 0 评论 0原文

我正在尝试编写一个访问 Web 服务的小应用程序,但该 Web 服务具有无效的 SSL 证书。我无法控制这个事实,因为它是由第三方管理的。

我尝试通过 IE(作为管理员和我自己的用户)访问该网站并安装证书,但它似乎没有做太多事情,因为下次我浏览它时会遇到同样的错误。

当我运行 svcutil 时,我得到以下输出:

C:\Personal>svcutil.exe https://b2b:9443/LiveFeed.svc?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'https://b2b:9443/LiveFeed.svc?wsdl' using
WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from https://b2b:9443/LiveFeed.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    Metadata contains a reference that cannot be resolved: 'https://b2b:9443/Liv
eFeed.svc?wsdl'.

    Could not establish trust relationship for the SSL/TLS secure channel with a
uthority 'b2b:9443'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.


HTTP GET Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    There was an error downloading 'https://b2b:9443/LiveFeed.svc?wsdl'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.

If you would like more help, type "svcutil /?"

我知道问题与证书无效有关,但我似乎无法使证书受信任。我该怎么做呢?

到目前为止我所做的就是单击错误,查看证书,然后安装它。我已经在Windows选择它自己的证书存储中尝试过这个,并且在个人和受信任的存储中,这些都没有什么区别。

即使我设法解决这个问题,我也担心当我在客户的电脑上安装该应用程序时会遇到问题,因为我们位于两个不同的国家。

任何帮助将不胜感激。

I'm trying to write a small app that accesses a webservice, but the webservice has an invalid SSL certificate. I've got no control over this fact as it's governed by a third party.

I've tried accessing the site via IE (As administrator and as my own user) and installing the certificate but it doesn't seem to do very much, as the next time I browse to it I get the same error.

When I run svcutil I get the following output:

C:\Personal>svcutil.exe https://b2b:9443/LiveFeed.svc?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'https://b2b:9443/LiveFeed.svc?wsdl' using
WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from https://b2b:9443/LiveFeed.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    Metadata contains a reference that cannot be resolved: 'https://b2b:9443/Liv
eFeed.svc?wsdl'.

    Could not establish trust relationship for the SSL/TLS secure channel with a
uthority 'b2b:9443'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.


HTTP GET Error
    URI: https://b2b:9443/LiveFeed.svc?wsdl

    There was an error downloading 'https://b2b:9443/LiveFeed.svc?wsdl'.

    The underlying connection was closed: Could not establish trust relationship
 for the SSL/TLS secure channel.

    The remote certificate is invalid according to the validation procedure.

If you would like more help, type "svcutil /?"

I know the issue is to do with the certificate being invalid, but I can't seem to make the certificate trusted. How would I go about doing this?

What I have done so far is click on the error, view the certificate, and install it. I've tried this in the certificate store that windows selects it's self and in the personal and trusted stores, none of this makes a difference.

Even if I manage to solve this I'm concerned that I'll run into issue when I install the application on my customers PC, given that we are in two different countries.

Any help would be appreciated.

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

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

发布评论

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

评论(3

攒一口袋星星 2024-10-12 20:55:02

它可能就像安装 cert 的根 CA 证书一样简单。

It may be as simple as installing the root CA certificate for the cert.

橘虞初梦 2024-10-12 20:55:02

此问题的答案可能会对您有所帮助:.net WebService,绕过 ssl 验证!

The answers for this question might help you: .net WebService, bypass ssl validation!

独享拥抱 2024-10-12 20:55:02
  try this before calling the service..

  ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(
            delegate
            {
                return true;
            });
  try this before calling the service..

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