我们有一个现有的ServiceContract
[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(Message message);
[OperationContract(IsOneWay = true)]
void ProcessMessageResult(MessageResult result);
}
Run Code Online (Sandbox Code Playgroud)
我们需要为它添加一个方法
[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);
}
Run Code Online (Sandbox Code Playgroud)
这会破坏使用此服务的任何现有wcf客户端吗?或者我们是否必须更新所有现有的wcf客户端?
编辑:此服务使用netTcpBinding和netMsmqBinding
我认为您现有的客户将继续工作.毕竟,这与SOAP和Web服务非常相似,因为客户端将连接到给定的URL并请求特定的服务.如果你采取方法,你将有破损的风险(只有我相信使用的方法),但添加应该没有痛苦.
我只涉足WCF,但以这种方式使用ASP.NET Web服务取得了巨大成功.
我刚刚使用 WCF 客户端 Windows 应用程序 (UWP) 对此进行了测试,并且在更新 WCF 服务应用程序后它继续工作。所以不:正如前面所回答的,当您添加方法时,您的客户端不会中断。
不过,我认为值得一提的是,使用 Visual Studio 2015 更新服务客户端是多么容易:
确保您的 WFC 服务正在运行。
只需前往Solution Explorer
,
扩张Service References
右键单击您的服务参考
点击Update Service Reference
如果收到错误消息,请重复最后一步。由于某种原因我不得不尝试几次。