hytos / ID2.Manager / MarkusImageCreateAPI / ImageCreate.asmx.cs @ 2ade1e61
이력 | 보기 | 이력해설 | 다운로드 (2.05 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Diagnostics; |
4 |
using System.Linq; |
5 |
using System.Reflection; |
6 |
using System.Web; |
7 |
using System.Web.Services; |
8 |
|
9 |
namespace MarkusImageCreateAPI |
10 |
{ |
11 |
/// <summary> |
12 |
/// ImageCreate의 요약 설명입니다. |
13 |
/// </summary> |
14 |
[WebService(Namespace = "http://markus.org/")] |
15 |
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] |
16 |
[System.ComponentModel.ToolboxItem(false)] |
17 |
// ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다. |
18 |
// [System.Web.Script.Services.ScriptService] |
19 |
public class ImageCreate : System.Web.Services.WebService |
20 |
{ |
21 |
private static string PROCESS_FILE_NAME = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("/Process"), "MarkusImageCreate.exe"); |
22 |
|
23 |
[WebMethod] |
24 |
public string Path() |
25 |
{ |
26 |
return PROCESS_FILE_NAME; |
27 |
} |
28 |
|
29 |
|
30 |
[WebMethod] |
31 |
public string Run(string ProjectNo,string DocID) |
32 |
{ |
33 |
var killProcess = Process.GetProcessesByName("MarkusImageCreate.exe"); |
34 |
|
35 |
foreach (var item in killProcess) |
36 |
{ |
37 |
if ((item.StartTime - DateTime.Now) > new TimeSpan(0, 1, 0)) |
38 |
{ |
39 |
item.Kill(); |
40 |
} |
41 |
} |
42 |
|
43 |
Process process = new Process(); |
44 |
|
45 |
ProcessStartInfo startInfo = new ProcessStartInfo |
46 |
{ |
47 |
WorkingDirectory = HttpContext.Current.Server.MapPath("/Process"), |
48 |
FileName = PROCESS_FILE_NAME, |
49 |
WindowStyle = ProcessWindowStyle.Hidden, |
50 |
CreateNoWindow = true, |
51 |
ErrorDialog = false, |
52 |
Verb = "runas", |
53 |
RedirectStandardInput = false, |
54 |
RedirectStandardError = false, |
55 |
Arguments = $"RUN {ProjectNo} {DocID}" |
56 |
}; |
57 |
|
58 |
process.StartInfo = startInfo; |
59 |
process.EnableRaisingEvents = false; |
60 |
process.Start(); |
61 |
return "Start"; |
62 |
} |
63 |
} |
64 |
} |