private HttpServerError StartServer() { try { _httpServer = new HttpServer(10); _httpServer.ProcessRequest += httpServer_ProcessRequest; _cacheSettings = new CacheSettings(); _httpServer.Start("http://+:" + _port + "/TWAIN@Web/"); } catch (Exception ex) { _logger.ErrorFormat("Code: {0}, Text: {1}", ((System.Net.HttpListenerException)ex).ErrorCode, ex); return new HttpServerError { Code = ((System.Net.HttpListenerException)ex).ErrorCode, Text = ex.ToString() }; } try { var fwHelper = new FierwallHelper(); fwHelper.AddRuleForPort(_port); } catch (Exception e) { return new HttpServerError { Code = 0, Text = e.ToString() }; } return null; }
private HttpServerError StartServer() { try { _httpServer = new HttpServer(10); _httpServer.ProcessRequest += httpServer_ProcessRequest; _cacheSettings = new CacheSettings(); _httpServer.Start("http://+:" + _port + "/TWAIN@Web/"); } catch (Exception ex) { _logger.ErrorFormat("Code: {0}, Text: {1}", ((System.Net.HttpListenerException)ex).ErrorCode, ex); return(new HttpServerError { Code = ((System.Net.HttpListenerException)ex).ErrorCode, Text = ex.ToString() }); } try { var fwHelper = new FierwallHelper(); fwHelper.AddRuleForPort(_port); } catch (Exception e) { return(new HttpServerError { Code = 0, Text = e.ToString() }); } return(null); }