简体   繁体   中英

Is it possible to not generate service part of wsdl contract in WCF?

I've written a WCF service and wonder if it somehow possible to not get the service part:

<wsdl:service name="MyService">
<wsdl:port name="BasicHttpBinding_MyService" binding="tns:BasicHttpBinding_MyService">
  <soap:address location="http://localhost:8000/MyService/Service" />
</wsdl:port>

generetad either directly in the wsdl or when svcutil pulls it down.

Or maybe it's easier to write a powershell script that just removes the service element?

implement IWsdlExportExtension. Inside it remove the parts you do not want:

http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iwsdlexportextension.aspx

It is not possible to prevent the built-in metadata from emitting the service portion of the WSDL.

Your options are to create a new metadata behavior, or even simpler, to turn off the metadata and simply provide a handcrafted WSDL via a well known Url.

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.

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