diff --git a/Project/Web/wwwroot/Common.html b/Project/Web/wwwroot/Common.html index f5550aa..bdcdf3e 100644 --- a/Project/Web/wwwroot/Common.html +++ b/Project/Web/wwwroot/Common.html @@ -448,8 +448,8 @@ // 코드그룹 목록 로드 function loadGroups() { showLoading(); - - fetch('http://127.0.0.1:7979/Common/GetGroups') + + fetch('/Common/GetGroups') .then(response => response.json()) .then(data => { groupData = data || []; @@ -517,8 +517,8 @@ // 특정 그룹의 데이터 로드 function loadDataByGroup(grp) { showLoading(); - - let url = 'http://127.0.0.1:7979/Common/GetList'; + + let url = '/Common/GetList'; if (grp) { url += '?grp=' + encodeURIComponent(grp); } @@ -642,10 +642,10 @@ // 삭제 실행 function confirmDelete() { if (!deleteTargetIdx) return; - + showLoading(); - - fetch('http://127.0.0.1:7979/Common/Delete', { + + fetch('/Common/Delete', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -704,10 +704,10 @@ svalue2: document.getElementById('editSvalue2').value, memo: document.getElementById('editMemo').value }; - + showLoading(); - - fetch('http://127.0.0.1:7979/Common/Save', { + + fetch('/Common/Save', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/Project/Web/wwwroot/DashBoard/index.html b/Project/Web/wwwroot/DashBoard/index.html index 89d3704..384af01 100644 --- a/Project/Web/wwwroot/DashBoard/index.html +++ b/Project/Web/wwwroot/DashBoard/index.html @@ -684,7 +684,7 @@ // 휴가 인원 Ajax 업데이트 function updateLeaveCount() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/TodayCountH') + fetch('/DashBoard/TodayCountH') .then(response => response.text()) .then(data => { const cleanData = data.replace(/"/g, ''); @@ -701,7 +701,7 @@ // 휴가자 목록 Ajax 업데이트 function updateHolidayList() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetholyUser') + fetch('/DashBoard/GetholyUser') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -780,7 +780,7 @@ // 구매요청 데이터 Ajax 업데이트 function updatePurchaseCount() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseWaitCount') + fetch('/DashBoard/GetPurchaseWaitCount') .then(response => response.json()) .then(data => { if (data) { @@ -805,7 +805,7 @@ // 휴가요청 데이터 Ajax 업데이트 function updateHolydayRequestCount() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetHolydayRequestCount') + fetch('/DashBoard/GetHolydayRequestCount') .then(response => response.json()) .then(data => { if (data) { @@ -825,7 +825,7 @@ // 사용자카운트 데이터 Ajax 업데이트 function updateCurrentUserCount() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetCurrentUserCount') + fetch('/DashBoard/GetCurrentUserCount') .then(response => response.json()) .then(data => { if (data) { @@ -872,7 +872,7 @@ // Todo 목록 Ajax 업데이트 function updateTodoList() { showLoading(); - fetch('http://127.0.0.1:7979/Todo/GetUrgentTodos') + fetch('/Todo/GetUrgentTodos') .then(response => response.json()) .then(data => { if (data.Success && data.Data) { @@ -1288,7 +1288,7 @@ // 출근 대상자 목록 로드 function loadPresentUserList() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetPresentUserList') + fetch('/DashBoard/GetPresentUserList') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -1373,7 +1373,7 @@ // 휴가요청 목록 로드 function loadHolidayRequestList() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetholyRequestUser') + fetch('/DashBoard/GetholyRequestUser') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -1463,7 +1463,7 @@ // 구매NR 목록 로드 function loadPurchaseNRList() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseNRList') + fetch('/DashBoard/GetPurchaseNRList') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -1538,7 +1538,7 @@ // 구매CR 목록 로드 function loadPurchaseCRList() { showLoading(); - fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseCRList') + fetch('/DashBoard/GetPurchaseCRList') .then(response => response.json()) .then(data => { let tableRows = ''; diff --git a/Project/Web/wwwroot/login.html b/Project/Web/wwwroot/login.html index f61eb94..5ce98b8 100644 --- a/Project/Web/wwwroot/login.html +++ b/Project/Web/wwwroot/login.html @@ -280,7 +280,7 @@ showLoading(); // HomeController의 로그인 API 호출 - fetch('http://127.0.0.1:7979/Home/Login', { + fetch('/Home/Login', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -373,7 +373,7 @@ // 그룹 목록 로드 function loadUserGroups() { - fetch('http://127.0.0.1:7979/DashBoard/GetUserGroups') + fetch('/DashBoard/GetUserGroups') .then(response => response.json()) .then(data => { const gcodeSelect = document.getElementById('gcode'); @@ -406,7 +406,7 @@ // 이전 로그인 정보 설정 function setPreviousLoginInfo() { // HomeController의 GetPreviousLoginInfo API 호출 - fetch('http://127.0.0.1:7979/Home/GetPreviousLoginInfo') + fetch('/Home/GetPreviousLoginInfo') .then(response => response.json()) .then(data => { if (data.Success && data.Data) { diff --git a/Project/fMain.cs b/Project/fMain.cs index 025fa19..8ae3d1a 100644 --- a/Project/fMain.cs +++ b/Project/fMain.cs @@ -121,21 +121,46 @@ namespace Project UpdateControls(); tmDisplay.Start(); //display timer - // Start OWIN host (실행환경 체크는 이미 완료됨) - try + // Start OWIN host with port fallback mechanism (포트 자동 탐색) + webok = false; + int startPort = 7979; + int maxPort = 8000; // 최대 8000 포트까지 시도 + + for (int port = startPort; port <= maxPort; port++) { - var options = new StartOptions(Pub.setting.WebServiceURL); - webApp = WebApp.Start(options); - Console.WriteLine("start webapp"); - FCOMMON.Pub.log.AddI("웹지원 서버 준비 완료"); - webok = true; - } - catch (Exception ex) - { - //Util.MsgE("Web Interface Error\r\n" + ex.Message)/; - Console.WriteLine(ex.Message); - FCOMMON.Pub.log.AddE("웹지원오류" + ex.Message); - webok = false; + try + { + var url = $"http://127.0.0.1:{port}"; + var options = new StartOptions(url); + webApp = WebApp.Start(options); + + // 성공 시 실제 사용된 포트 저장 + Pub.WebServiceURL = url; + + Console.WriteLine($"웹서버 시작 성공: {url}"); + FCOMMON.Pub.log.AddI($"웹지원 서버 준비 완료 (포트: {port})"); + + if (port != startPort) + { + FCOMMON.Pub.log.AddAT($"기본 포트({startPort})가 사용 중이어서 포트 {port}를 사용합니다."); + } + + webok = true; + break; // 성공하면 루프 종료 + } + catch (Exception ex) + { + Console.WriteLine($"포트 {port} 시작 실패: {ex.Message}"); + + // 마지막 포트까지 실패한 경우에만 에러 로그 + if (port == maxPort) + { + FCOMMON.Pub.log.AddE($"웹서버 시작 실패: 포트 {startPort}~{maxPort} 모두 사용 불가"); + FCOMMON.Pub.log.AddE("상세 오류: " + ex.Message); + webok = false; + } + // 다음 포트 시도 + } } // WebView2 초기화 재시도 (필요시)