Saturday, 15 March 2014

connection timeout in asp.net -



connection timeout in asp.net -

i build web application , every thing works fine . after set on real work got problem

after 30 minutes working in connection loading , through exception : request time out.

so have restart server or restart iis site access code 1 time again ?

why happened , how prepare it.

i utilize connection class connect database in whole code :

public class connection { public static sqlconnection open() { seek { string constr = @"data source=.\sqlexpress;attachdbfilename=|datadirectory|\sarc.mdf;integrated security=true; max pool size=100; user instance=true"; sqlconnection con = new sqlconnection(constr); con.open(); homecoming con; } grab (sqlexception odbcex) { homecoming null; } } public static sqlconnection open(string constr) { seek { sqlconnection con = new sqlconnection(constr); con.open(); homecoming con; } grab (sqlexception odbcex) { homecoming null; } } public static void close(sqlconnection constr) { seek { constr.close(); } grab (sqlexception odbcex) { } } public static sqldatareader query(string query, bool isreader) { seek { sqlconnection con = open(); sqlcommand com = new sqlcommand(query, con); sqldatareader rd = com.executereader(); homecoming rd; } grab (sqlexception odbcex) { homecoming null; } } private static sqlconnection con; public static int query(string query) { seek { con = (con == null ? new sqlconnection() : con); if (con.state != system.data.connectionstate.open) con = open(); sqlcommand com = new sqlcommand(query, con); int result = com.executenonquery(); con.close(); homecoming result; } grab (sqlexception odbcex) { homecoming 0; } } }

how can prepare problem ??? plz help

asp.net connection

No comments:

Post a Comment