是否添加一个方法到WCF的ServiceContract打破现有的客户端?客户端、方法、WCF、ServiceContract

2023-09-04 00:24:34 作者:地心侵略者

我们有一个现有的ServiceContract

We have an existing ServiceContract

[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
        [OperationContract(IsOneWay = true)]
        void ProcessMessage(Message message);

        [OperationContract(IsOneWay = true)]
        void ProcessMessageResult(MessageResult result);
}

,我们需要一种方法添加到它

and we need to add a method to it

[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
        [OperationContract(IsOneWay = true)]
        void ProcessMessage(Message message);

        [OperationContract(IsOneWay = true)]
        void ProcessMessageResult(MessageResult result);

        [OperationContract(IsOneWay = true)]
        void ProcessBlastMessage(BlastMessage blastMessage);
}

这会不会打破使用该服务的任何现有的WCF客户端?还是我们必须更新所有现有的WCF客户端?

Will this break any existing wcf clients that are using this service? Or will we have to update all existing wcf clients?

编辑:使用该服务既NetTcpBinding的和netMsmqBinding

This service is using both netTcpBinding and netMsmqBinding

推荐答案

我觉得你的现有客户将继续工作。毕竟这是非常相似的SOAP和web服务中,客户端将连接到给定的URL和请求特定的服务。如果你的方法走,你会破碎险(仅在使用该方法,我相信),但加入应该是无痛苦。

I think your existing clients will continue to work. After all this is very similar to SOAP and web services in that the client will connect to the given URL and request a specific service. If you take methods away you will risk breakage (only if the method is used I believe) but adding should be pain free.

我只涉足WCF,但以这种方式取得了巨大成功使用的ASP.NET Web服务。

I've only dabbled in WCF but have used the ASP.NET web services in this way to great success.