合约需要 Duplex,但绑定“BasicHttpBinding”;不支持它或未正确配置以支持它
我的项目是silverlight并使用Ria服务。 我想创建一个 WCF 服务, 这是我的代码
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MessageDuplex : IServiceSide
{
public void Attach(string s)
{
}
}
[ServiceContract]
interface IClientSide
{
[OperationContract(IsOneWay = true)]
void SendMessage(string s);
}
[ServiceContract(CallbackContract = typeof(IClientSide))]
interface IServiceSide
{
[OperationContract(IsOneWay = true)]
void Attach(string s);
}
当我在没有 CallbackContract 的情况下定义 IServiceSide 时,这会正确添加到 silverlight 项目中,但是当我使用 CallbackContract 时,添加 Service Referense 时会引发此错误: “合同需要 Duplex,但绑定‘BasicHttpBinding’不支持它,或者未正确配置以支持它。”
my project is silverlight and use Ria service.
I want to create a WCF Service,
this is my code
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MessageDuplex : IServiceSide
{
public void Attach(string s)
{
}
}
[ServiceContract]
interface IClientSide
{
[OperationContract(IsOneWay = true)]
void SendMessage(string s);
}
[ServiceContract(CallbackContract = typeof(IClientSide))]
interface IServiceSide
{
[OperationContract(IsOneWay = true)]
void Attach(string s);
}
When i defined IServiceSide without CallbackContract this is add to silverlight project correctly, but when i use CallbackContract this error raise when add Service Referense :
"Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BasicHttpBinding
不支持双工服务。您必须使用 PollingDuplexHttpBinding。BasicHttpBinding
doesn't support duplex services. You must use PollingDuplexHttpBinding.