c# - Where should I put logic for run once after web api server is bootstrapped? -
for example have server:
using (httpselfhostserver server = new httpselfhostserver(config)) { server.openasync().wait(); console.writeline("press enter quit."); console.readline(); }
and controller:
public class productscontroller : apicontroller { // here route("....") public product getproductbyid(int id) { var product = productsprovider.firstordefault((p) => p.id == id); if (product == null) { throw new httpresponseexception(httpstatuscode.notfound); } return product; } }
after server unexpectedly terminated want process requests cached in database. how can call controller/action or simulate request after server bootstrapped?
Comments
Post a Comment