asp.net - WCF using Nhibernate + Oracle fails to connect database intermittently -
we have 3 tier application developed using wcf. our web layer [32 bit windows 2003 sp1] calls wcf service [64 bit windows 2008 r2 on nlb] communicates oracle 10g db [ 64 bit linux ]. db connection established using nhibernate 2.2. wcf communication uses basichttpbinding.
in 32 bit test environment application works well, on live environment specified above experience crashes. per logging repetitive error is,
system.applicationexception :> inner exception being
nhibernate.adoexception: while preparing select stderrorme0_.err_no err1_10_, stderrorme0_.err_type err2_10_, .... ...., std_error_message stderrorme0_ stderrorme0_.err_no=:p0 error occurred ---> system.invalidoperationexception: timeout expired. timeout period elapsed prior obtaining connection pool. may have occurred because pooled connections in use , max pool size reached.
this error repeats, table being fetched changes.
temporary solution: restarting wcf service hosted in iis.
please suggestions , solutions work. post raised after many trial , errors following various blogs.
this because of connections not being disposed of (https://stackoverflow.com/a/5442062/221708), in case may caused not disposing of nhibernate sessions properly. should wrap connections in using blocks, should wrap nhibernate sessions in using blocks.
here couple of articles on managing nhibernate sessions in wcf:
also remember if using sessionfactory.opensession(idbconnection) overload, responsible closing connection returned session.close().
Comments
Post a Comment