这实际上并不是一个问题,但我有这样的要求,因此我需要在C#中编写一个Windows应用程序来监视我们所有的内部和外部系统。这些系统中有一些是网站,一些是Windows应用程序,它们不断地在包括soap api调用的数据库中传输数据。我的应用程序需要做的是监视这些系统,并在发生停机时间以及停机多久时通知相关用户。C# - Windows窗体应用程序监视器
我已经完成了使用SQL Server作为数据库管理系统的数据库设计,但是我在实现方面陷入困境。我可以用什么方法来实现这个目标? TCP/IP? 此应用程序应该每隔x秒运行一次。
我已经在一个枚举中创建了一些标志,它会在应用程序状态正常,处于错误状态或应该警告用户时不断检查应用程序状态。除此之外,我还创建了一个构造函数,它将通过DLL初始化服务监视器的所有组件。
事情是这样:
[Flags]
public enum ClientApplicationState
{
ERROR = 0,
WARNING = 1,
OK = 2
}
/// <summary>
/// Constructor which sets up and initalizes all the components for the Service Monitoring DLL
/// </summary>
/// <param name="applicationName">The Name Of The Application</param>
/// <param name="port">The port on which to listen to</param>
/// <param name="timerPeriod"> Optional time in milisecinds to overide the default update freq (default is 1000)</param>
public ServiceMonitor(string applicationName, short port, int timerPeriod = 1000)
{
_messages = new List<string>();
_state = ClientApplicationState.OK;
//TODO: Throw port exception
try
{
_monClient = new MonitoringClient(applicationName, ClientApplicationState.OK, "Starting Up",
Process.GetCurrentProcess().ProcessName, port);
}
catch (Exception e)
{
}
InitTimer(timerPeriod);
_updateTimer.Enabled = true;
}
的网站托管和是活和Windows应用我们的Windows 2012 R2服务器上运行。
我该如何解决这个问题?
我觉得这个词“服务”在语境之外被轻微误解。我需要监控的应用程序不是Windows服务,也不是我应该写一个Windows服务 - 只是为了清除它。 –