Well, the first thing I would do is refactor the code. A lot of the changes I did were simply to serve the page width limitations here on CP as well as to ease debugging, but the key is to put a try/catch block around ALL of the code. With the code below, you can now step through the code and verify that all of the objects you're creating are valid, as well as find out what's failing:
public class PipeFactory : DuplexChannelFactory<IStringReverser>{} <br />
public partial class MyForm
{
private void MyMethod()
{
try
{
ServerEvents myCallbacks = new ServerEvents();
NetTcpBinding binding = new NetTcpBinding();
EndpointAddress endPoint = new EndpointAddress("net.tcp://localhost/PipeReverse");
PipeFactory pipeFactory = new PipeFactory(myCallbacks, binding, endpoint);
IStringReverser pipeProxy = pipeFactory.CreateChannel();
string str = pipeProxy.ReverseString("asaf maimon");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}