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)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for php and J2EE, but not 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.
Here's an example of a service configuration with a base address specified. Note this goes in the <configuration><services>
element in your config:
<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.
Two ways:
a) Download wsdl file and do below steps :
i) Open visual studio command prompt as an administrator.
ii) Type below command:
wsdl.exe [path To Your WSDL File]
b) With endpoint :
i) Open Visual studio command prompt as an administrator.
ii) type below command: wsdl.exe http://localhost:9000/MyService
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.