简体   繁体   English

用于C#的WSDL生成器

[英]WSDL Generator for C#

Does anyone know of a good tool to generate the WSDL for a service contract written in C# (ie set of methods that are tagged as "[OperationContract]" using WCF)? 有没有人知道为C#编写的服务合同生成WSDL的好工具(即使用WCF标记为“[OperationContract]”的方法集合)? All the tools I've found work the other way around: create code stubs from a WSDL. 我发现的所有工具都是相反的:从WSDL创建代码存根。 I don't want to have to hand-jam a WSDL file. 我不想手动阻塞WSDL文件。 I've found tools for php and J2EE, but not C#. 我找到了php和J2EE的工具,但没有找到C#。 Thanks! 谢谢!

svcutil或者只是快速托管它并点击MEX点:)

Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end. 最简单的方法是使用基本地址设置来托管服务,然后从浏览器中点击它,并在末尾添加“?wsdl”。

Here's an example of a service configuration with a base address specified. 以下是指定基址的服务配置示例。 Note this goes in the <configuration><services> element in your config: 请注意,这在<configuration><services>中的<configuration><services>元素中:

  <service name="MyServiceName" behaviorConfiguration="MyServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9000/MyService"/>
      </baseAddresses>
    </host>
    <endpoint address="net.tcp://localhost:9001/MyService"
              binding="netTcpBinding"
              contract="IMyService"
              bindingConfiguration="MyServiceBinding"/>
  </service>

Once you get it hosted, just go to http://localhost:9000/MyService?wsdl to see the WSDL definition. 托管后,只需转到http://localhost:9000/MyService?wsdl即可查看WSDL定义。

Two ways: 两种方式:

a) Download wsdl file and do below steps : a) 下载wsdl文件并执行以下步骤

i) Open visual studio command prompt as an administrator. i)以管理员身份打开visual studio命令提示符。

ii) Type below command: ii)键入以下命令:

wsdl.exe [path To Your WSDL File] wsdl.exe [WSDL文件的路径]

b) With endpoint : b) 使用端点

i) Open Visual studio command prompt as an administrator. i)以管理员身份打开Visual Studio命令提示符。

ii) type below command: wsdl.exe http://localhost:9000/MyService ii)键入以下命令:wsdl.exe http:// localhost:9000 / MyService

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

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