开发者

sql clr timeout

I have a CLR Stored procedure that calls a webmethod. The webmethod call is a somewhat long running taks ( about 3 minutes to complete). The CLR sp does not call Sql server at all, However it times out. How can I adjust the time out. The code is as follows:

  [SqlProcedure]
    public static int RunSessionForTrid(string sessionName, string trid, out SqlString msg)
    {
        string sxml = GetSessionForTrid(sessionName, trid);
        using (BaaNServices b = new BaaNServices())
        {
            try
            {
                开发者_Python百科msg = b.BaanSession(sxml);
                SqlContext.Pipe.Send((string)msg);
                return 0;
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                SqlContext.Pipe.Send(ex.Message);
                //throw ex;
                return -1;
            }
        }
    }
    #endregion  


You could also run the method asynchronosly. The CLR sp would end immediately and you could not return a result, but you would not have any timeout problems.

Disposing the Webreference should be done in the async callback.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜