简体   繁体   English

Windows Phone 8回调WCF服务

[英]Windows Phone 8 Callback WCF Service

I have a Windows Phone 8 Application and a WCF Service that implements Callback model. 我有一个Windows Phone 8应用程序和一个实现回调模型的WCF服务。 I'm having trouble configuring the service reference. 我在配置服务参考时遇到问题。 I've tested the service using wsDualHttpBinding for a Windows Form Application Client instead the WP8 App, and it worked perfectly. 我已经使用wsDualHttpBinding为Windows窗体应用程序客户端而不是WP8应用程序测试了该服务,并且它运行良好。 However, this binding is not suitable for WP8 Apps and I have to change configuration. 但是,此绑定不适用于WP8 Apps,我必须更改配置。 Can someone suggest me a simple working configuration for the service that works with my WP8 Application? 有人可以为我建议一个与我的WP8应用程序一起使用的服务的简单工作配置吗?

Right click on References and Select Add Service Reference 右键单击“ 引用”,然后选择“ 添加服务引用”

在此处输入图片说明

Type your WCF address 输入您的WCF地址

在此处输入图片说明

Click OK and you should see the Added Web Service 单击确定,您应该看到添加的Web服务

在此处输入图片说明

The Visual Studio will automatically implements the WCF service. Visual Studio将自动实现WCF服务。 Then you can use it 那你就可以用

MyWebService.Service1Client client = new MyWebService.Service1Client();

I don't know if this can help you. 我不知道这是否可以帮助您。

As explain here: http://blogs.windows.com/windows_phone/b/wpdev/archive/2010/05/03/understanding-microsoft-push-notifications-for-windows-phones.aspx 如此处所述: http : //blogs.windows.com/windows_phone/b/wpdev/archive/2010/05/03/understanding-microsoft-push-notifications-for-windows-phones.aspx

the problem is due to the fact that it is not possible to implement something like a callback or publish/subscribe model between WP8 App and a Service. 该问题是由于无法在WP8 App和服务之间实现诸如回调或发布/订阅模型之类的事实。 This is to avoid energy loss of the phone. 这是为了避免手机的能量损失。 So, Microsoft permits notifications from Service using the Microsoft Push Notification Service (MPNS). 因此,Microsoft允许使用Microsoft Push Notification Service(MPNS)从Service发出通知。 All is well-explained in the documentation linked above. 上面链接的文档中对此都有很好的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM