简体   繁体   English

svcutil.exe => 无法从 https://...svc?wsdl 获取元数据

[英]svcutil.exe => Cannot obtain Metadata from https://…svc?wsdl

I have to use an .SVC WebService in my MVC project.我必须在我的 MVC 项目中使用.SVC WebService。 When I want to add the service through Add Service Reference , then I get the following error:当我想通过Add Service Reference 添加服务时,我收到以下错误:

There was an error downloading https://.............svc/ $metadata'.下载https://................svc/ $metadata' 时出错。 The request was aborted: Could not create SSL/TLS secure channel.请求被中止:无法创建 SSL/TLS 安全通道。

I tried generating my required classes to use the service with the following command in CMD:我尝试使用 CMD 中的以下命令生成所需的类以使用该服务:

svcutil.exe https://.............svc?wsdl svcutil.exe https://................svc?wsdl

But I get the following error message:但我收到以下错误消息:

Error: Cannot obtain Metadata from https://.............svc?wsdl错误:无法从https://................svc?wsdl获取元数据

How can I solve this problem?我怎么解决这个问题?

The aforementioned error mainly indicates that we should trust the server certificate before we download the service metadata.上述错误主要表明我们在下载服务元数据之前应该信任服务器证书。
As @rene mentioned.正如@rene 提到的。 After we have generated the client proxy class, we could instantiate the class to invoke the method like calling a local method.在我们生成客户端代理 class 之后,我们可以实例化 class 来调用方法,就像调用本地方法一样。
But we also could invoke the service by adding service reference, which is a built-in feature in VS.但是我们也可以通过添加服务引用来调用服务,这是 VS 的一个内置特性。
在此处输入图像描述
Here is an official guideline, wish it is useful to you.这是官方指南,希望对您有用。
https://docs.microsoft.com/en-us/dotnet/framework/wcf/accessing-services-using-a-wcf-client https://docs.microsoft.com/en-us/dotnet/framework/wcf/accessing-services-using-a-wcf-client
Feel free to let me know if there is anything I can help with.如果有什么我可以帮忙的,请随时告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM