IIS .Net 7 응용프로그램 배포하고 실행할 때 오류 해결.
Error.
An error occurred while processing your request.
Request ID:
Development Mode
Swapping to the Development environment displays detailed information about the error that occurred.
The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.
확인: 서버> 이벤트뷰어> Widnoes로그> 응용프로그램 > 에러 로그를 찾아 보자!
Index.razor 파일에서 아래 WithUrl이 로컬 디버깅할때와 서버에 배포한 경로가 달라서 그렇다.
hubConnection = new HubConnectionBuilder()
.WithUrl("https://ddddfajkdsjfasdjfsadf/SigHub/SigHub") // Navigation.ToAbsoluteUri("/SigHub"))
.Build();
string _user =string.Empty ;
//SendMessageToGroup
hubConnection.On<string, string>("ReceiveMessage", (user, message) =>
{
var encodedMsg = $"{user}: {message}";
messages.Add(encodedMsg);
InvokeAsync(StateHasChanged);
_user = user;
});
await hubConnection.StartAsync();