auskommentiert

This commit is contained in:
2026-06-30 11:20:33 +02:00
parent c3a0d31ccb
commit db059ef591
2 changed files with 59 additions and 54 deletions

View File

@@ -28,56 +28,7 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
var winIdentity = WindowsIdentity.GetCurrent();
var securityContext = ServiceSecurityContext.Current;
var principal = Thread.CurrentPrincipal;
var proc = Process.GetCurrentProcess();
var ipInfo = OperationContext.Current?.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
var httpInfo = OperationContext.Current?.IncomingMessageProperties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
var basedir = AppDomain.CurrentDomain.BaseDirectory;
var log = new
{
WindowsIdentity = new
{
winIdentity?.Name,
winIdentity?.IsAuthenticated,
winIdentity?.AuthenticationType
},
ServiceSecurityContext = new
{
PrimaryIdentity = securityContext?.PrimaryIdentity?.Name,
WindowsIdentity = securityContext?.WindowsIdentity?.Name,
},
Process = new
{
proc.ProcessName,
proc.StartTime
},
AppDomain = new
{
AppDomain.CurrentDomain.BaseDirectory,
AppDomain.CurrentDomain.FriendlyName
},
Environment = new
{
Environment.UserName,
Environment.MachineName,
Environment.OSVersion,
Environment.CurrentDirectory,
Environment.Is64BitProcess
},
ThreadPrincipal = principal?.Identity?.Name,
IP = ipInfo?.Address,
Port = ipInfo?.Port,
UserAgent = httpInfo?.Headers["User-Agent"],
};
var str = JsonConvert.SerializeObject(log, Formatting.Indented);
File.WriteAllText(BeWoServerPathHelper.GetApiServiceTestFile(), str, Encoding.UTF8);
//generateApiServiceTestFile();
return ApiResponse<string>.SuccessResponse("Hello World!");
}
@@ -108,5 +59,59 @@ namespace BeWo.Service.ServiceImplementations
return ApiResponse<decimal>.SuccessResponse(sum ?? 0);
}
private void generateApiServiceTestFile()
{
var winIdentity = WindowsIdentity.GetCurrent();
var securityContext = ServiceSecurityContext.Current;
var principal = Thread.CurrentPrincipal;
var proc = Process.GetCurrentProcess();
var ipInfo = OperationContext.Current?.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
var httpInfo = OperationContext.Current?.IncomingMessageProperties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
var basedir = AppDomain.CurrentDomain.BaseDirectory;
var log = new
{
WindowsIdentity = new
{
winIdentity?.Name,
winIdentity?.IsAuthenticated,
winIdentity?.AuthenticationType
},
ServiceSecurityContext = new
{
PrimaryIdentity = securityContext?.PrimaryIdentity?.Name,
WindowsIdentity = securityContext?.WindowsIdentity?.Name,
},
Process = new
{
proc.ProcessName,
proc.StartTime
},
AppDomain = new
{
AppDomain.CurrentDomain.BaseDirectory,
AppDomain.CurrentDomain.FriendlyName
},
Environment = new
{
Environment.UserName,
Environment.MachineName,
Environment.OSVersion,
Environment.CurrentDirectory,
Environment.Is64BitProcess
},
ThreadPrincipal = principal?.Identity?.Name,
IP = ipInfo?.Address,
Port = ipInfo?.Port,
UserAgent = httpInfo?.Headers["User-Agent"],
};
var str = JsonConvert.SerializeObject(log, Formatting.Indented);
File.WriteAllText(BeWoServerPathHelper.GetApiServiceTestFile(), str, Encoding.UTF8);
}
}
}