xml - Restarts c# windows service on a url call -
i have c# application runs windows service. application uses open source tiny http server url communications. there flext application developed update , select data sqlite database via c# application using get/post methods.
i have url called https:/domainname:portnumber/folder/tree/200 reads data database of c# service , returns huge amount of data in xml form client.
some times when url gets called totral c# windows service getting restarted. , needs refresh flext application start again. server firewall windows service installed turned off , machine reachable.
when checked log found after url call, server restarts. also, when checked traffic in fiddler got error below:
http/1.1 502 fiddler - connection failed content-type: text/html; charset=utf-8 connection: close timestamp: 10:18:52.685 [fiddler] socket connection (domainname) failed. <br />errorcode: 10061.
the code used calling folder/tree below
public string tree() { try { string langstr = ""; if (request.querystring["lang"] != null && !string.isnullorempty(request.querystring["lang"].value)) { langstr = request.querystring["lang"].value.tostring(); } else { thingzdatabase db = sessiondatabase; langstr = db.defaultlanguage; db = null; } foldertree = new foldertree(convert.toint32(id), true, sessiondatabase, langstr); xmldocument doc = foldertree.xml; response.contenttype = contenttype.xml; langstr = null; foldertree.db2 = null; foldertree = null; //gc.collect(); return doc.innerxml; } catch (exception e) { touchserver.log(logger.messagetype.error, 1, e.tostring()); return "get folder tree failed, reason:" + e.message; } }
to execute query sqlite database code below used
public sqlitedatareader executesql(string sqlexpr) { if (conn.state != connectionstate.open open(datafile); using (sqlitecommand cmd = conn.createcommand()) { cmd.commandtext = sqlexpr + ";pragma read_uncommitted = 1;"; cmd.commandtype = commandtype.text; return cmd.executereader(); } }
whats size of return string? write file verify length of return string.
there may problems web service if length exceeds limit.
the following link discusses similar problem. http://social.msdn.microsoft.com/forums/en-us/wcf/thread/58e420e9-43a3-4119-b541-d18158038e36/
the service may crash if have not handled exception.
Comments
Post a Comment