feat: 포트 충돌 방지 - 자동 포트 탐색 및 상대 경로 적용
백엔드 변경사항: - fMain.cs: 포트 7979~8000 범위에서 자동 탐색 및 fallback 기능 추가 - 성공한 포트를 Pub.WebServiceURL에 자동 저장 - 포트 충돌 시 자동으로 다음 포트 시도 프론트엔드 변경사항: - login.html: 하드코딩 URL 3곳을 상대 경로로 변경 - Common.html: 하드코딩 URL 4곳을 상대 경로로 변경 - DashBoard/index.html: 하드코딩 URL 10곳을 상대 경로로 변경 효과: - 포트 충돌 시 사용자 개입 없이 자동 해결 - 포트 변경에 무관하게 프론트엔드 자동 동작 - 다양한 환경에서 안정적인 서비스 제공 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -449,7 +449,7 @@
|
||||
function loadGroups() {
|
||||
showLoading();
|
||||
|
||||
fetch('http://127.0.0.1:7979/Common/GetGroups')
|
||||
fetch('/Common/GetGroups')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
groupData = data || [];
|
||||
@@ -518,7 +518,7 @@
|
||||
function loadDataByGroup(grp) {
|
||||
showLoading();
|
||||
|
||||
let url = 'http://127.0.0.1:7979/Common/GetList';
|
||||
let url = '/Common/GetList';
|
||||
if (grp) {
|
||||
url += '?grp=' + encodeURIComponent(grp);
|
||||
}
|
||||
@@ -645,7 +645,7 @@
|
||||
|
||||
showLoading();
|
||||
|
||||
fetch('http://127.0.0.1:7979/Common/Delete', {
|
||||
fetch('/Common/Delete', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -707,7 +707,7 @@
|
||||
|
||||
showLoading();
|
||||
|
||||
fetch('http://127.0.0.1:7979/Common/Save', {
|
||||
fetch('/Common/Save', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -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 = '';
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -121,22 +121,47 @@ namespace Project
|
||||
UpdateControls();
|
||||
tmDisplay.Start(); //display timer
|
||||
|
||||
// Start OWIN host (실행환경 체크는 이미 완료됨)
|
||||
// Start OWIN host with port fallback mechanism (포트 자동 탐색)
|
||||
webok = false;
|
||||
int startPort = 7979;
|
||||
int maxPort = 8000; // 최대 8000 포트까지 시도
|
||||
|
||||
for (int port = startPort; port <= maxPort; port++)
|
||||
{
|
||||
try
|
||||
{
|
||||
var options = new StartOptions(Pub.setting.WebServiceURL);
|
||||
var url = $"http://127.0.0.1:{port}";
|
||||
var options = new StartOptions(url);
|
||||
webApp = WebApp.Start<OWIN.Startup>(options);
|
||||
Console.WriteLine("start webapp");
|
||||
FCOMMON.Pub.log.AddI("웹지원 서버 준비 완료");
|
||||
|
||||
// 성공 시 실제 사용된 포트 저장
|
||||
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)
|
||||
{
|
||||
//Util.MsgE("Web Interface Error\r\n" + ex.Message)/;
|
||||
Console.WriteLine(ex.Message);
|
||||
FCOMMON.Pub.log.AddE("웹지원오류" + ex.Message);
|
||||
Console.WriteLine($"포트 {port} 시작 실패: {ex.Message}");
|
||||
|
||||
// 마지막 포트까지 실패한 경우에만 에러 로그
|
||||
if (port == maxPort)
|
||||
{
|
||||
FCOMMON.Pub.log.AddE($"웹서버 시작 실패: 포트 {startPort}~{maxPort} 모두 사용 불가");
|
||||
FCOMMON.Pub.log.AddE("상세 오류: " + ex.Message);
|
||||
webok = false;
|
||||
}
|
||||
// 다음 포트 시도
|
||||
}
|
||||
}
|
||||
|
||||
// WebView2 초기화 재시도 (필요시)
|
||||
if (Pub.InitWebView == 0)
|
||||
|
||||
Reference in New Issue
Block a user