C# 从 VS2010 WCF Service 应用程序获取 WSDL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11840516/
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 19:27:56  来源:igfitidea点击:

Getting WSDL from VS2010 WCF Service application

c#.netvisual-studio-2010wcfwsdl

提问by LCJ

I Just created a sample WCF Service application in Visual Studio 2010. It has the following configuration and service code. I need to see the corresponding WSDL generated. What I need to do to see the corresponding WSDL?

我刚刚在 Visual Studio 2010 中创建了一个示例 WCF 服务应用程序。它具有以下配置和服务代码。我需要查看生成的相应 WSDL。我需要做什么才能看到相应的 WSDL?

enter image description here

在此处输入图片说明

CODE

代码

public class Service1 : IService1
{
    public string GetData(int value)
    {
        return string.Format("You entered: {0}", value);
    }

    public CompositeType GetDataUsingDataContract(CompositeType composite)
    {
        if (composite == null)
        {
            throw new ArgumentNullException("composite");
        }
        if (composite.BoolValue)
        {
            composite.StringValue += "Suffix";
        }
        return composite;
    }
}

REFERENCES

参考

  1. How to generate a wsdl file of a wcf service library project?
  2. Is there any way I can create a WSDL file from WCF Service Application?
  3. WSDL automatically generated by WCF
  1. 如何生成wcf服务库项目的wsdl文件?
  2. 有什么方法可以从 WCF 服务应用程序创建 WSDL 文件?
  3. WCF自动生成的WSDL

采纳答案by danish

You can right click on svc file and select view in browser option. Then, add ?WSDL to the end of URL. It would show the WSDL file.

您可以右键单击 svc 文件并选择在浏览器选项中查看。然后,将 ?WSDL 添加到 URL 的末尾。它将显示 WSDL 文件。

You can also make use of SVCUtil for this.

您也可以为此使用 SVCUtil。

回答by user854301

Try to add ?wsdlto the end of your service url.

尝试添加?wsdl到您的服务 url 的末尾。

回答by Nattrass

If you need to export the WSDL to a file you can use SVCUtil to accomplish this.

如果您需要将 WSDL 导出到文件,您可以使用 SVCUtil 来完成此操作。

svcutil /t:metadata http://servername/path/WCFSeviceApplication.svc?singleWsdl