refactor: OWIN 웹서버 제거, WebView2 VirtualHost 방식으로 전환

- OWIN 관련 패키지 제거 (Microsoft.Owin.*, Microsoft.AspNet.WebApi.*)
- 모든 Web API 컨트롤러 삭제 (Controllers/*.cs)
- Startup.cs 삭제
- 기존 WebView2 Dialog 삭제 (fDashboard, fHolyday, fJobReport, fLogin_WB, fCommon)
- fDashboardNew만 유지 (SetVirtualHostNameToFolderMapping 방식)
- fMain.cs에서 OWIN 서버 시작 코드 제거
- 품목검색/설명서 메뉴 수정 (로컬 파일 참조로 변경)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
backuppc
2025-11-25 17:30:08 +09:00
parent 44af041d1a
commit 8a0a4ccc4c
36 changed files with 16 additions and 7324 deletions

View File

@@ -1,6 +1,5 @@
using FBS0000;
using FCOMMON;
using Microsoft.Owin.Hosting;
using Project.Dialog;
using System;
using System.Collections.Generic;
@@ -18,8 +17,6 @@ namespace Project
public partial class fMain : fBase
{
string SearchKey = string.Empty;
private IDisposable webApp;
bool webok = false;
private ChatClientService chatService;
private System.Windows.Forms.Timer chatBlinkTimer;
private bool chatHasNewMessage = false;
@@ -90,7 +87,6 @@ namespace Project
private void __Closing(object sender, FormClosingEventArgs e)
{
webApp?.Dispose();
MessageWindow.CloseAll();
if (closeforce == false)
{
@@ -134,48 +130,6 @@ namespace Project
UpdateControls();
tmDisplay.Start(); //display timer
// 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 url = $"http://127.0.0.1:{port}";
var options = new StartOptions(url);
webApp = WebApp.Start<OWIN.Startup>(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 초기화 재시도 (필요시)
if (Pub.InitWebView == 0)
{
@@ -208,7 +162,7 @@ namespace Project
// WebView2 로그인이 아닌 경우에만 여기서 후처리 실행
// WebView2 로그인의 경우 OnLoginCompleted()에서 호출됨
if (!(webok && Pub.InitWebView == 1))
if (Pub.InitWebView != 1)
{
OnLoginCompleted();
}
@@ -284,24 +238,19 @@ namespace Project
void Func_Login()
{
//Pub.InitWebView = 2;
this.sbWeb.Text = $"Host:{(webok ? "O" : "X")},WebView:{Pub.InitWebView},Server:{Pub.WebServiceURL}";
if (webok && Pub.InitWebView == 1)
this.sbWeb.Text = $"WebView:{Pub.InitWebView}";
if (Pub.InitWebView == 1)
{
//using (var f = new Dialog.fLogin_WB())
// if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK)
// Application.ExitThread();
// WebView2 기반 대시보드 로그인
Menu_Dashboard();
}
else
{
// 기존 WinForms 로그인
using (var f = new Dialog.fLogin())
if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK)
Application.ExitThread();
}
}
void Func_RunStartForm()
{
@@ -319,15 +268,8 @@ namespace Project
string formkey = "HOLY";
if (!ShowForm(formkey))
{
Form f;
if (webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached)
f = new FBS0000.fHolyday();
else
f = new FBS0000.fHolyday();
AddForm(formkey, f);
AddForm(formkey, new FBS0000.fHolyday());
}
}
void _SetLang()
@@ -1077,8 +1019,8 @@ namespace Project
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
var url = $"{Pub.WebServiceURL}/item/find";
Util.RunExplorer(url);
// OWIN 서버 제거로 인해 기능 비활성화
Util.MsgI("품목검색 기능은 대시보드에서 이용해 주세요.");
}
private void layoutToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1104,8 +1046,12 @@ namespace Project
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
Util.RunExplorer($"{Pub.WebServiceURL}/Manual");
// 로컬 PDF 파일 열기
var pdfPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Manual.pdf");
if (System.IO.File.Exists(pdfPath))
Util.RunExplorer(pdfPath);
else
Util.MsgE("설명서 파일을 찾을 수 없습니다.");
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)