【发布时间】:2014-04-01 18:18:08
【问题描述】:
我最近在我的服务中添加了一个 ping 方法,它在回调通道上调用了一个 pong 方法:
public partial class myService
{
public void Ping()
{
OperationContext.Current.GetCallbackChannel<IKeepAliveEvents>().Pong();
}
}
我还在pong方法中添加了回调接口:
namespace myService
{
[ServiceContract]
public interface IKeepAliveEvents
{
[OperationContract(IsOneWay = true)]
void Pong();
}
}
在我的 WCF 服务的主接口定义中继承:
[ServiceContract]
public interface IMyServiceEvents : IEvents1, IEvents2, ..., IEvents9, IKeepAliveEvents
{
[OperationContract(IsOneWay = true)]
void TestEvent(string s);
}
然后按如下方式使用:
[ServiceContract(CallbackContract=typeof(IMyServiceEvents)]
public interface IMyService : ISomething1, ISomething2, ..., ISomething13
{
...
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, MaxItemsInObjectGraph = 2147483647)]
public partial class myService : IMyService, IDisposable, IServiceBehavior, IErrorHandler {
...
}
问题是......当我的 WCF 服务正在运行时,它不会让我从接口定义中在我的客户端应用程序中实现 pong 方法,因为每次我尝试更新服务时它似乎都不存在...并且可以肯定我正在正确的 URL 更新正确的服务,并且可以肯定我使用的是最新版本的代码,因为我已经能够将调试器附加到我的服务并在 Ping 方法中放置一个断点它叫乒乓。更奇怪的是,Ping 方法确实存在供我的客户端使用,但 Pong 方法似乎并不想出现在客户端这里:
public partial class myClientEndpoint : myServiceCallback {
// I would expect Pong to be implementable here.
}
可能是什么问题?
【问题讨论】:
标签: c# web-services wcf visual-studio service