C# 从文件目录添加 WSDL 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11674271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 18:47:19  来源:igfitidea点击:

Adding WSDL files from file directory

c#visual-studioweb-serviceswsdl

提问by Tarik

I have WSDL files that I need to add to my project as web references. They are located with .wsdlextensions in my local directory. I have never added them like this so I am not really sure how I can add them as a web reference.

我有 WSDL 文件,需要将其作为 Web 引用添加到我的项目中。它们位于.wsdl我本地目录中的扩展名中。我从来没有像这样添加过它们,所以我不确定如何将它们添加为网络参考。

I haven't been able to find something useful. Any ideas?

我一直没能找到有用的东西。有任何想法吗?

采纳答案by Aghilas Yakoub

  1. Right click on project and select add Web Reference

  2. In dialog Box type on the URL File://test.xsdl

  1. 右键单击项目并选择添加 Web 引用

  2. 在 URL File://test.xsdl 上的对话框中键入

回答by Paolo del Mundo

Right click on the project, click on 'Add Service Reference'. Add the path to the WSDL file. It will generate the code to call the service for you.

右键单击项目,单击“添加服务引用”。将路径添加到 WSDL 文件。它将生成代码来为您调用服务。

回答by Cromm

No answer was accurate for me, but for VS2019, to add a wsdl file as a service reference, I right-clicked on the project -> add -> connected services -> Microsfot WCF Web Services reference -> browse the .wsdl file. This will generate the code to call the referenced services.

对我来说没有答案是准确的,但是对于 VS2019,要添加 wsdl 文件作为服务引用,我右键单击项目 -> 添加 -> 连接的服务 -> Microsfot WCF Web 服务引用 -> 浏览 .wsdl 文件。这将生成调用引用服务的代码。