wcf-4

Basic HTTP Binding isn't configured properly

天涯浪子 提交于 2019-12-03 14:15:19
i have configured a WCF service with wsHTTPBinding but even then i get the error Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it. here is the service contract definition <ServiceContract(SessionMode:=SessionMode.Required)> Public Interface IPrivateService Here is the service implementation definition <ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)> Public Class PrivateService Implements IPrivateService Here is the config settings <services> <service behaviorConfiguration="behaviorAction" name="Viking

Correct way to close WCF 4 channels effectively

青春壹個敷衍的年華 提交于 2019-12-03 11:28:11
I am using the following ways to close the WCF 4 channels. Is this right way to do it? using (IService channel = CustomChannelFactory<IService>.CreateConfigurationChannel()) { channel.Open(); //do stuff }// channels disposes off?? Although not strictly directed at the channel, you can do: ChannelFactory<IMyService> channelFactory = null; try { channelFactory = new ChannelFactory<IMyService>(); channelFactory.Open(); // Do work... channelFactory.Close(); } catch (CommunicationException) { if (channelFactory != null) { channelFactory.Abort(); } } catch (TimeoutException) { if (channelFactory !=