I have windows service created on my machine and another WCF service created and hosted. I wanted to know how to communicate WCF service and Windows service using Signalr. The problem is like I don't know how to couple both WCF and windows service together to make the connection tight.
The other hand if my WCF service has some data I want to pass that data to windows service instantly.
Here is the code snippet I have in my windows service.
namespace POCWindowsService { public partial class TestService : ServiceBase { System.Timers.Timer timeDelay; int count;
public TestService()
{
InitializeComponent();
timeDelay = new System.Timers.Timer();
timeDelay.Elapsed += new System.Timers.ElapsedEventHandler(WorkProcess);
}
public void WorkProcess(object sender, System.Timers.ElapsedEventArgs e)
{
string process = "Timer Tick" + count;
LogService(process);
}
protected override void OnStart(string[] args)
{
LogService("POC Service Started");
timeDelay.Enabled = true;
}
private void LogService(string content)
{
FileStream fs = new FileStream(@"F:\Test\TestServiceLog.txt", FileMode.OpenOrCreate);
var sw = new StreamWriter(fs);
sw.BaseStream.Seek(0, SeekOrigin.End);
sw.WriteLine(content);
sw.Flush();
sw.Close();
}
protected override void OnStop()
{
LogService("POC Service Stopped");
timeDelay.Enabled = false;
}
}
}
My WCF service runs on http://localhost:8080/ and my windows service name POCWindowsService.
I want to know how can I connect these two services using Signalr.
Thanks