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() {
|
function loadGroups() {
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
fetch('http://127.0.0.1:7979/Common/GetGroups')
|
fetch('/Common/GetGroups')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
groupData = data || [];
|
groupData = data || [];
|
||||||
@@ -518,7 +518,7 @@
|
|||||||
function loadDataByGroup(grp) {
|
function loadDataByGroup(grp) {
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
let url = 'http://127.0.0.1:7979/Common/GetList';
|
let url = '/Common/GetList';
|
||||||
if (grp) {
|
if (grp) {
|
||||||
url += '?grp=' + encodeURIComponent(grp);
|
url += '?grp=' + encodeURIComponent(grp);
|
||||||
}
|
}
|
||||||
@@ -645,7 +645,7 @@
|
|||||||
|
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
fetch('http://127.0.0.1:7979/Common/Delete', {
|
fetch('/Common/Delete', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -707,7 +707,7 @@
|
|||||||
|
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
fetch('http://127.0.0.1:7979/Common/Save', {
|
fetch('/Common/Save', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
@@ -684,7 +684,7 @@
|
|||||||
// 휴가 인원 Ajax 업데이트
|
// 휴가 인원 Ajax 업데이트
|
||||||
function updateLeaveCount() {
|
function updateLeaveCount() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/TodayCountH')
|
fetch('/DashBoard/TodayCountH')
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const cleanData = data.replace(/"/g, '');
|
const cleanData = data.replace(/"/g, '');
|
||||||
@@ -701,7 +701,7 @@
|
|||||||
// 휴가자 목록 Ajax 업데이트
|
// 휴가자 목록 Ajax 업데이트
|
||||||
function updateHolidayList() {
|
function updateHolidayList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetholyUser')
|
fetch('/DashBoard/GetholyUser')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let tableRows = '';
|
let tableRows = '';
|
||||||
@@ -780,7 +780,7 @@
|
|||||||
// 구매요청 데이터 Ajax 업데이트
|
// 구매요청 데이터 Ajax 업데이트
|
||||||
function updatePurchaseCount() {
|
function updatePurchaseCount() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseWaitCount')
|
fetch('/DashBoard/GetPurchaseWaitCount')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -805,7 +805,7 @@
|
|||||||
// 휴가요청 데이터 Ajax 업데이트
|
// 휴가요청 데이터 Ajax 업데이트
|
||||||
function updateHolydayRequestCount() {
|
function updateHolydayRequestCount() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetHolydayRequestCount')
|
fetch('/DashBoard/GetHolydayRequestCount')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -825,7 +825,7 @@
|
|||||||
// 사용자카운트 데이터 Ajax 업데이트
|
// 사용자카운트 데이터 Ajax 업데이트
|
||||||
function updateCurrentUserCount() {
|
function updateCurrentUserCount() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetCurrentUserCount')
|
fetch('/DashBoard/GetCurrentUserCount')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -872,7 +872,7 @@
|
|||||||
// Todo 목록 Ajax 업데이트
|
// Todo 목록 Ajax 업데이트
|
||||||
function updateTodoList() {
|
function updateTodoList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/Todo/GetUrgentTodos')
|
fetch('/Todo/GetUrgentTodos')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.Success && data.Data) {
|
if (data.Success && data.Data) {
|
||||||
@@ -1288,7 +1288,7 @@
|
|||||||
// 출근 대상자 목록 로드
|
// 출근 대상자 목록 로드
|
||||||
function loadPresentUserList() {
|
function loadPresentUserList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetPresentUserList')
|
fetch('/DashBoard/GetPresentUserList')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let tableRows = '';
|
let tableRows = '';
|
||||||
@@ -1373,7 +1373,7 @@
|
|||||||
// 휴가요청 목록 로드
|
// 휴가요청 목록 로드
|
||||||
function loadHolidayRequestList() {
|
function loadHolidayRequestList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetholyRequestUser')
|
fetch('/DashBoard/GetholyRequestUser')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let tableRows = '';
|
let tableRows = '';
|
||||||
@@ -1463,7 +1463,7 @@
|
|||||||
// 구매NR 목록 로드
|
// 구매NR 목록 로드
|
||||||
function loadPurchaseNRList() {
|
function loadPurchaseNRList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseNRList')
|
fetch('/DashBoard/GetPurchaseNRList')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let tableRows = '';
|
let tableRows = '';
|
||||||
@@ -1538,7 +1538,7 @@
|
|||||||
// 구매CR 목록 로드
|
// 구매CR 목록 로드
|
||||||
function loadPurchaseCRList() {
|
function loadPurchaseCRList() {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseCRList')
|
fetch('/DashBoard/GetPurchaseCRList')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let tableRows = '';
|
let tableRows = '';
|
||||||
|
|||||||
@@ -280,7 +280,7 @@
|
|||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
// HomeController의 로그인 API 호출
|
// HomeController의 로그인 API 호출
|
||||||
fetch('http://127.0.0.1:7979/Home/Login', {
|
fetch('/Home/Login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -373,7 +373,7 @@
|
|||||||
|
|
||||||
// 그룹 목록 로드
|
// 그룹 목록 로드
|
||||||
function loadUserGroups() {
|
function loadUserGroups() {
|
||||||
fetch('http://127.0.0.1:7979/DashBoard/GetUserGroups')
|
fetch('/DashBoard/GetUserGroups')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const gcodeSelect = document.getElementById('gcode');
|
const gcodeSelect = document.getElementById('gcode');
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
// 이전 로그인 정보 설정
|
// 이전 로그인 정보 설정
|
||||||
function setPreviousLoginInfo() {
|
function setPreviousLoginInfo() {
|
||||||
// HomeController의 GetPreviousLoginInfo API 호출
|
// HomeController의 GetPreviousLoginInfo API 호출
|
||||||
fetch('http://127.0.0.1:7979/Home/GetPreviousLoginInfo')
|
fetch('/Home/GetPreviousLoginInfo')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.Success && data.Data) {
|
if (data.Success && data.Data) {
|
||||||
|
|||||||
@@ -121,21 +121,46 @@ namespace Project
|
|||||||
UpdateControls();
|
UpdateControls();
|
||||||
tmDisplay.Start(); //display timer
|
tmDisplay.Start(); //display timer
|
||||||
|
|
||||||
// Start OWIN host (실행환경 체크는 이미 완료됨)
|
// Start OWIN host with port fallback mechanism (포트 자동 탐색)
|
||||||
try
|
webok = false;
|
||||||
|
int startPort = 7979;
|
||||||
|
int maxPort = 8000; // 최대 8000 포트까지 시도
|
||||||
|
|
||||||
|
for (int port = startPort; port <= maxPort; port++)
|
||||||
{
|
{
|
||||||
var options = new StartOptions(Pub.setting.WebServiceURL);
|
try
|
||||||
webApp = WebApp.Start<OWIN.Startup>(options);
|
{
|
||||||
Console.WriteLine("start webapp");
|
var url = $"http://127.0.0.1:{port}";
|
||||||
FCOMMON.Pub.log.AddI("웹지원 서버 준비 완료");
|
var options = new StartOptions(url);
|
||||||
webok = true;
|
webApp = WebApp.Start<OWIN.Startup>(options);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
// 성공 시 실제 사용된 포트 저장
|
||||||
{
|
Pub.WebServiceURL = url;
|
||||||
//Util.MsgE("Web Interface Error\r\n" + ex.Message)/;
|
|
||||||
Console.WriteLine(ex.Message);
|
Console.WriteLine($"웹서버 시작 성공: {url}");
|
||||||
FCOMMON.Pub.log.AddE("웹지원오류" + ex.Message);
|
FCOMMON.Pub.log.AddI($"웹지원 서버 준비 완료 (포트: {port})");
|
||||||
webok = false;
|
|
||||||
|
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 초기화 재시도 (필요시)
|
// WebView2 초기화 재시도 (필요시)
|
||||||
|
|||||||
Reference in New Issue
Block a user