fix: Blazor WASM 클라이언트 localhost:5265 하드코딩 전면 제거
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 12s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 8s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Successful in 2m40s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 12s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 8s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Successful in 2m40s
증상: 프로덕션에서 'Connection refused (localhost:5265)' 오류
원인: WASM 클라이언트 3개 파일에 localhost:5265 null-fallback이 박혀 있어
브라우저가 사용자 로컬 포트로 API 요청을 시도함.
수정 파일:
- ApiClient.cs: null fallback 제거 → 잘못된 DI 구성 시 명시적 예외 발생
- Users.razor: LoadUsers()의 BaseAddress 강제 설정 제거
- CustomAuthenticationStateProvider.cs: baseUrl fallback 제거, 상대 경로 사용
올바른 동작: Client/Program.cs에서 builder.HostEnvironment.BaseAddress로
DI 등록 → 항상 현재 도메인 기준 상대 경로로 API 호출.
This commit is contained in:
@@ -11,9 +11,13 @@ public class ApiClient
|
||||
public ApiClient(HttpClient http, ILogger<ApiClient> logger)
|
||||
{
|
||||
_http = http;
|
||||
// BaseAddress is set by the DI registration in Client/Program.cs via
|
||||
// builder.HostEnvironment.BaseAddress — never hardcode a port here.
|
||||
if (_http.BaseAddress == null)
|
||||
{
|
||||
_http.BaseAddress = new Uri("http://localhost:5265/");
|
||||
throw new InvalidOperationException(
|
||||
"ApiClient: HttpClient.BaseAddress is null. " +
|
||||
"Ensure the HttpClient is registered with HostEnvironment.BaseAddress in Client/Program.cs.");
|
||||
}
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user