From b10f0e6b94be7c932ff0266acb85a39da7e59efe Mon Sep 17 00:00:00 2001 From: Paul Volavsek Date: Mon, 22 Jan 2024 08:31:34 +0100 Subject: [PATCH] dont crash on net.pipe urls --- .../ProcessHost/ProcessHostPlebeian.cs | 15 ++++++++++----- .../Services/HostingService.cs | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs b/src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs index d1b16257..23191ac2 100644 --- a/src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs +++ b/src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs @@ -131,6 +131,10 @@ private async Task StartHosting(string[] uris) { var url = new Uri(uri); var hostingType = GetHostingType(url); + if (hostingType is null) + { + continue; + } Action? addEndpointsInner = hostingType switch { @@ -145,18 +149,18 @@ private async Task StartHosting(string[] uris) case PackageType.SCU: if (instanceInterface == typeof(IDESSCD)) { - await _hosting.HostService(url, hostingType, (IDESSCD)instance, addEndpoints); + await _hosting.HostService(url, hostingType.Value, (IDESSCD)instance, addEndpoints); } else if (instanceInterface == typeof(IITSSCD)) { - await _hosting.HostService(url, hostingType, (IITSSCD)instance, addEndpoints); + await _hosting.HostService(url, hostingType.Value, (IITSSCD)instance, addEndpoints); } break; case PackageType.Queue: - await _hosting.HostService(url, hostingType, (IPOS)instance, addEndpoints); + await _hosting.HostService(url, hostingType.Value, (IPOS)instance, addEndpoints); break; case PackageType.Helper: - await _hosting.HostService(url, hostingType, (IHelper)instance, addEndpoints); + await _hosting.HostService(url, hostingType.Value, (IHelper)instance, addEndpoints); break; default: throw new NotImplementedException(); @@ -201,13 +205,14 @@ private static (object, Action, Type) GetScu(IServiceProvider se throw new Exception("Could not resolve SCU with supported country. (Curently supported are DE and IT)"); } - private static HostingType GetHostingType(Uri url) + private static HostingType? GetHostingType(Uri url) { return url.Scheme.ToLowerInvariant() switch { "grpc" => HostingType.GRPC, "rest" => HostingType.REST, "http" or "https" or "net.tcp" => HostingType.SOAP, + "net.pipe" => null, _ => throw new NotImplementedException($"The hosting type for the URL {url} is currently not supported.") }; } diff --git a/src/fiskaltrust.Launcher/Services/HostingService.cs b/src/fiskaltrust.Launcher/Services/HostingService.cs index 7ebdb262..3ffab458 100644 --- a/src/fiskaltrust.Launcher/Services/HostingService.cs +++ b/src/fiskaltrust.Launcher/Services/HostingService.cs @@ -186,6 +186,9 @@ private WebApplication CreateSoapHost(WebApplicationBuilder builder, Uri uri, case "net.tcp": builder.AddServiceEndpoint(instance.GetType(), typeof(T), CreateNetTcpBinding(), uri, null); break; + case "net.pipe": + _logger.LogWarning("net.pipe url support will be added in an upcomming version of the launcher 2.0."); + break; default: throw new Exception(); };