설정
asp.net core 에서 unix domain socket으로 서비스 바인딩하기
에리스
2024. 6. 23. 19:13
k8s에서 sidecar 테스트를 위해 진행했는데... 잘 되는 것 확인!
윈도우에서도 잘 된다.!
var builder = WebApplication.CreateBuilder(args);
var socketName = "my.socket";
var socketPath = Path.Join(Path.GetTempPath(), socketName);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
socketPath = Path.Join("/tmp", socketName);
if (File.Exists(socketPath))
File.Delete(socketPath);
// Configure Kestrel to listen at the UDS path
builder.WebHost.ConfigureKestrel(
opts => opts.ListenUnixSocket(socketPath));