안녕하세요. 처음뵙겠습니다 풀리지 않는 문제가있어서 검색하던 도중에 발견하게 되어 질문 드립니다.
이걸로 이번주 내내 헤메고 있네요 ㅠㅠ
환경은 : iis, asp.net
* [IISStop.bat]
psexec -u [username]-p [Password] \\[RemoteServerIpAddress] -s -d -i cmd.exe /c C:\site_stop.bat
* [site_stop.bat]
C:\Windows\System32\inetsrv\appcmd stop sites "TestSite"
IISStop.bat파일을 관리자 권한으로 실행시키면 원격 서버의 site_stop.bat파일을 실행 시켜서 해당 원격서버의 TestSite서비스를 멈추는데
이걸 asp.net 웹 컨트롤에서 서버 내부에 있는 IISStop.bat파일을 실행시키면 동작하지 않습니다.
var info = new ProcessStartInfo()
{
FileName = "c:\\BatFile\\IISStop.bat",
UseShellExecute = false,
CreateNoWindow = false,
RedirectStandardError = true,
Verb = "runas"
};
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.Start();
var outerr = p.StandardError.ReadToEnd(); <-- 이부분에서 디버그도 더이상 진행되지 않고 사라집니다
var output = p.StandardOutput.ReadToEnd();
//p.WaitForExit();
Console.ReadLine();
뭐가 문제인 걸까요.. 배치파일을 바로 실행시키면 동작하는데
asp.net의 컨트롤에서 저장된 배치파일을 실행시키면 동작하지 않고 있습니다.
도와주세요 ㅠㅠ
------- 추가 -------------------------------------------------------------
var outerr = p.StandardError.ReadToEnd(); <-- 이부분에서 디버그도 더이상 진행되지 않고 사라집니다
var output = p.StandardOutput.ReadToEnd();
이 부분을 제거하니 전처럼 진행되지 않던 현상이 사라졌습니다. 제대로 진행은 되는데 정상동작은 하지 않고 있습니다.
[최초 등록일: ]
[최종 수정일: 8/29/2018]