开发者

WCF architecture: using callbacks, events, 2x service-client?

I have my main application installed (ServerApp) on a LAN server (which is behind a firewall, so the server can access the internet but it cannot be accessed from internet directly (No static开发者_如何学Go IP)), and a monitoring application (MonitorApp) on my PC which is outside the LAN and directly connects to internet.

ServerApp should send some notification events (basically some statistics) to MonitorApp in a timely manner (every 1-2 seconds).

Performance is a critical factor in this app, so I have to do everything possible to reduce the traffic.

  • How can I make a connection between these two applications? Will I be able to use WCF callbacks in this scenario? (considering that I cannot see the server directly from my MonitorApp).
  • Is there a performance preference in using using a WCF service and client on one side and another WCF service and client on the other side as opposed to a WCF callback contract. One thing I guess is that I have to use 2x client-services in both sides because I have to use basic HttpBinding to pass the firewall.
  • Any general guidelines on how to implement it?
  • If I plan to write an application like MonitorApp, but also be able to send commands to ServerApp (for clarification, let's name it ControlApp), should I use another approach?

Apologies for multiple questions. And thank you.


Looks like hard to achieve solution.

I have my main application installed (ServerApp) on a LAN server (which is behind a firewall, so the server can access the internet but it cannot be accessed from internet directly (No static IP))

Based on this it should be clear that server can't host a service because you will not be able to access it from outside the LAN. So unless your ServerApp connects to service in hosted in MonitorApp or some port forwarding is configured on Firewall there will be no way to achieve that.

For me the correct design is that ServiceApp host a service which can provide monitoring data and second service for issuing commands. In your scenario this is not possible. You can partially solve monitoring by hosting service in MonitorApp:

You can expose service contract like

[ServiceContract]
public interface MonitoringAppContract
{
  [OperationContract(IsOneWay=true)]
  void SendMonitoringData(MonitoringData data);
}

The ServerApp will regulary call this operation and pass monitoring data to MonitorApp. Because of one way call it will not be blocked by data processing on MonitorApp but it will also not be notified about exceptions. The problem here is that WCF service exposed on MonitorApp must be available or ServerApp will wait for Open timeout.

Duplex communication will also not be the solution because again ServerApp will have to estabilish connection - again problems with timeouts moreover duplex communication is sessionful and it requires other care about inactivity timeouts etc.

Your problem can be easily solved by relay which is provided by Azure services but you have to pay for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜