Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the reason of ServiceHost Faulted event

I have got a MyServiceBase class which inherits from ServiceBase. Inside MyService I Have got a ServiceHost for my WCF-service, whic has only one method with IsOneWay=true property. I used this code to initialize it:

host = new ServiceHost(typeof(MyService));
host.Opened += new EventHandler(host_Opened);
host.Closed += new EventHandler(host_Closed);
host.Faulted += new EventHandler(host_Faulted);
host.UnknownMessageReceived += new EventHandler<UnknownMessageReceivedEventArgs>(host_UnknownMessageReceived);
host.Open();

Sometimes host raises Faulted event, but EventArgs in *host_Faulted* method are always empty, so I cannot find out the reason of it. Please help. Thanks in regard.

like image 995
Alekstim Avatar asked Dec 10 '12 10:12

Alekstim


1 Answers

This link might prove usefull for better ways of WCF Fault handling and debugging:

How do I prevent a WCF service from enter a faulted state?

So instead of answering your specific question, i am recommending a better way of achieving your requirement.

like image 57
c0D3l0g1c Avatar answered Nov 14 '22 01:11

c0D3l0g1c