c# - WCF tcp connections stay open when process is killed -


I have seen similar questions here but no answer was found. I have an app that uses WCF to open a connection at a remote address, sometimes when I kill an app from the task manager or the app closes unconstitutional, the connection remains open and then when I If I restart the app then the one exception I told is already available to me.

Some questions:

  1. Why do I have to do this kind of connection after killing this process Remains open?
  2. How do I close this connection when the process closes inadvertently?
  3. Before I try to create a new one, how can I close the connection?

    serer side:

      var url = Config.GetRemoteServerUrl (); Var binding = new NetTcpBinding (); Binding. Security.mode = SecurityMode.No; Binding Reliable session. Enabled = Config.Relaiable session; Binding Reliable session. Inactivity time = TimeSpain Maxwell; Binding.modeconnection = configure. Max Concentrations; Binding. ReaderQQs.MaxArereLang = Config Reader QuatusMaxArere Lang; Binding.mocsairev messaging = config Max Reesemmascias; Binding.Sendetimeout = new timespan (0,0, 0, 0, config., Sand timeout); Binding OpenTimeout = New TimeSpain (0,0, 0, 0, config. Opentimeout); Host = new service host (serverfacda.ininstance, new urine [] (new uriy)}; host.addserviceEndpoint (typeof (ITSOServiceContract, binding, url); host.Open (); ServerFacade = host.Asnttonon form of form In ISERverFacade;    

    You can try to add the Channel_Closed event handler and force it You can use the abort () method to apply for settlement.

      operationcontact. Current channel.clause + = channels Try Void Channel_Closed (object sender, EventArgs e) {var success = false; {stop proxy.}; Success = true;} Finally {if (success!) Proxy.}}  < / Pre>  

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -