Simplified version of what I\'m trying to achieve:
Can you use a singleton for your service? If so you could implement it like this:
[ServiceContract]
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class MyClass : IMyClass
{
Form1 _f;
public MyClass(Form1 f)
{
_f = f;
}
[OperationContract]
public void Alert(string mess)
{
_f.Text = mess;
}
}
Then when you setup your service host, you instantiate it and pass it the form:
MyClass c = new MyClass(this);
string baseAddress = "http://localhost:12345/Serv";
var host = new ServiceHost(c, new Uri(baseAddress));