Reputation: 6586
Given a valid Binding and EndpointAddress, I have a WCF Duplex ChannelFactory like so:
NetTcpBinding svcBinding = new NetTcpBinding();
svcBinding.ReliableSession.Enabled = true;
EndpointAddress svcEndpointAddress = new EndpointAddress(new Uri("net.tcp:// + ServiceAddress + "/Service"), EndpointIdentity.CreateDnsIdentity(UserPrincipalName));
DuplexChannelFactory dcf = new DuplexChannelFactory<IService>(new InstanceContext(this), svcBinding);
dcf.Opened += OnCommunicationOpened;
dcf.Faulted += OnCommuicationFaulted;
IService svc = dcf.CreateChannel(svcEndpointAddress);
public void OnCommunicationOpened(object sender, EventArgs e)
{
// do something . . .
}
public void OnCommunicationFaulted(object sender, EventArgs e)
{
// do something else . . .
}
The opened event has no problem firing, but the faulted event does not fire when I close my service. How can I get the Faulted event to fire?
Upvotes: 1
Views: 324