Wcf服务客户端没有处置释放会话杀死等我使用abort()但他们没有工作会话仍然活着。 [英] Wcf service client not dispose release session kill etc I used abort() but they didn't work session still live.

查看:140
本文介绍了Wcf服务客户端没有处置释放会话杀死等我使用abort()但他们没有工作会话仍然活着。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IncidentManagementClient IM = Connection.Connect();





我的逻辑在这里工作正常。





My Logic here works fine.

 response = IM.RetrieveIncidentKeysList(request);
IM.Abort(); 
return response;





我尝试过:



获得响应后我想杀死或处置或释放会话表单服务管理器应用程序,但它们不起作用。你可以帮助我。



What I have tried:

After Getting response i want to kill or dispose or release session form Service manager application but they didn't work. can you help me.

推荐答案

通常你会在你的情况下关闭一个连接IM.Close()IM.Abort()由于某种原因被使用连接出现故障。另外最好在Try..Catch块中使用这样的连接
Normally you would close a connection with in your case "IM.Close()" IM.Abort() is used when for some reason the connection is faulted. Also it is better to use connections like this within a Try..Catch block


try
                {
                    
                    RetrieveIncidentKeysListResponse response = new 
                    RetrieveIncidentKeysListResponse();
                    RetrieveIncidentKeysListRequest request = new 
                    RetrieveIncidentKeysListRequest();
                    request.model = new IncidentModelType();
                    request.model.keys = new IncidentKeysType();
                    request.model.instance = new IncidentInstanceType(); 
                    request.model.instance.IMTicketStatus = new 
                    ServiceReference1.StringType();
                    request.model.instance.IMTicketStatus.Value = "Open";
                    request.model.instance.OutageFlag = new 
                    ServiceReference1.BooleanType();
                    request.model.instance.OutageFlag.Value = true;
                    request.model.instance.Domain = new ServiceReference1.StringType();
                    request.model.instance.Domain.Value = "MMnBB"; 

                    response = IM.RetrieveIncidentKeysList(request); 
                    return response;
                }
                catch (Exception ex)
                {
                    string Text3Write = "Problem Occurred With Incident Data Retrieval 
                    Based on DB rules";

                    using (StreamWriter sw = File.AppendText(path))
                    {
                        sw.WriteLine(Text3Write);
                        sw.WriteLine("Exception Occurred :" + ex.ToString());
                    }
                }





这是我在try和catch :)中的代码,但是IM.Close();不在这里工作,他们表现得像abort();我不知道为什么?



Here is my code in try and catch :) but IM.Close(); not working here they behave like abort(); i don't know why ?


这篇关于Wcf服务客户端没有处置释放会话杀死等我使用abort()但他们没有工作会话仍然活着。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆