增加终身元素EWS流认购 [英] Increasing the Lifetime element for EWS Streaming Subscription Connection

查看:286
本文介绍了增加终身元素EWS流认购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用微软的EWS,我们能够聆听到一个邮箱,并在新的电子邮件进来采取行动,但我无法弄清楚如何避免连接超时。

Using Microsoft's EWS, we're able to listen to a mailbox and take actions when a new email comes in. However, I can't figure out how to avoid the connection timing out.

每微软,这里是一个StreamingSubscriptionConnection的构造:

Per Microsoft, here is the constructor for a StreamingSubscriptionConnection:

public StreamingSubscriptionConnection (
    ExchangeService service,
    int lifetime
)

在我的应用程序,我编写它如下:

In my app, I've coded it as follows:

service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
StreamingSubscriptionConnection conn = new StreamingSubscriptionConnection(service, 30);

在换句话说,我得设置为30分钟超时(寿命),因为这是最高我已经能够进行设置。我怎样才能提高呢?或者说,我怎么可以欺骗这个订阅到活着,哪怕〜45分钟传入电子邮件之间发生吗?

In other words, I've got the timeout (lifetime) set to 30 minutes, because that's the highest I've been able to set it. How can I increase this? Or, how can I trick this subscription into staying alive, even if ~45 minutes transpire between incoming emails?

推荐答案

30分钟硬限制。你无法将其更改为更高的价值。

30 minutes is a hard limit. You can not change it to a higher value.

为了解决这个问题,电线了一个处理程序来连接实例的OnDisconnect事件的OnDisconnected处理程序。重新启动从那里订阅(只是调用从处理器connection.Open())。

To solve this issue, wire up a handler to the OnDisconnected handler of the OnDisconnect event of the connection instance. Restart the subscription from there (just call connection.Open() from that handler).

这篇关于增加终身元素EWS流认购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆