markus / ConvertService / ServiceBase / Markus.Service.Station / StationService / ServiceStationBase.cs @ a5e5fff6
이력 | 보기 | 이력해설 | 다운로드 (2.12 KB)
1 |
using log4net; |
---|---|
2 |
using Markus.Service.WcfService; |
3 |
using Salaros.Configuration; |
4 |
using System; |
5 |
using System.Collections.Generic; |
6 |
using System.ComponentModel; |
7 |
using System.Data; |
8 |
using System.Diagnostics; |
9 |
using System.Globalization; |
10 |
using System.Linq; |
11 |
using System.ServiceModel; |
12 |
using System.ServiceProcess; |
13 |
using System.Text; |
14 |
using System.Threading.Tasks; |
15 |
using System.Timers; |
16 |
|
17 |
namespace Markus.Service |
18 |
{ |
19 |
public partial class ServiceStationTask |
20 |
{ |
21 |
//protected ILog logger = LogManager.GetLogger(typeof(ServiceStation)); |
22 |
|
23 |
private ServiceHost wcfServiceHost = null; |
24 |
public ServiceStationTask() |
25 |
{ |
26 |
} |
27 |
|
28 |
public void OnStart() |
29 |
{ |
30 |
|
31 |
try |
32 |
{ |
33 |
Markus.Library.Installer.Install(); |
34 |
} |
35 |
catch (Exception e) |
36 |
{ |
37 |
System.Diagnostics.Debug.WriteLine(e.ToString()); |
38 |
} |
39 |
|
40 |
try |
41 |
{ |
42 |
Stopprocess(); |
43 |
} |
44 |
catch (Exception e) |
45 |
{ |
46 |
System.Diagnostics.Debug.WriteLine(e.ToString()); |
47 |
//logger.Error("Stop Process Error. ", e); |
48 |
} |
49 |
|
50 |
try |
51 |
{ |
52 |
StartWcfService(); |
53 |
} |
54 |
catch (Exception e) |
55 |
{ |
56 |
System.Diagnostics.Debug.WriteLine(e.ToString()); |
57 |
//logger.Error("start Wcf Service Error. ", e); |
58 |
} |
59 |
|
60 |
try |
61 |
{ |
62 |
setDataBaseWaitingList(); |
63 |
} |
64 |
catch (Exception e) |
65 |
{ |
66 |
System.Diagnostics.Debug.WriteLine(e.ToString()); |
67 |
//logger.Error("Database Waiting List Error . ", e); |
68 |
} |
69 |
} |
70 |
|
71 |
private Exception innerexception(Exception ex) |
72 |
{ |
73 |
if(ex.InnerException !=null) |
74 |
{ |
75 |
return new Exception(ex.ToString() + "\n" + innerexception(ex.InnerException).ToString()); |
76 |
} |
77 |
else |
78 |
{ |
79 |
return ex; |
80 |
} |
81 |
} |
82 |
|
83 |
public void OnStop() |
84 |
{ |
85 |
StopWcfService(); |
86 |
Stopprocess(); |
87 |
} |
88 |
} |
89 |
} |