In WCF, is there a way to omit / hide a ServiceOperation or a DataMember from the WSDL?

前端 未结 2 1423
孤街浪徒
孤街浪徒 2021-01-13 11:48

I have an existing WCF service. At some point, sometimes an [OperationContract] or a [DataMember] in a data contract becomes [Obsolete]

2条回答
  •  逝去的感伤
    2021-01-13 12:04

    WCF is pretty versioning tolerant within some constraints as documented in this MSDN article. It's probably too late for your current service to adopt some of these practices but you can accomplish what you want by creating new ServiceContract interfaces that remove the operations and enums you need hidden.

    You would also need to create a new endpoint for the new the interface. The same service implementation can support multiple interfaces with a little tweaking so the changes shouldn't be too extensive. Any new clients would use the new service endpoint while the the old clients would use the original endpoint.

提交回复
热议问题