diff --git a/tutorial/netstd/Client/Client.csproj b/tutorial/netstd/Client/Client.csproj
index 1f87751..cf01951 100644
--- a/tutorial/netstd/Client/Client.csproj
+++ b/tutorial/netstd/Client/Client.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Client</AssemblyName>
     <PackageId>Client</PackageId>
@@ -32,7 +32,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
   </ItemGroup>
 
   <ItemGroup>
diff --git a/tutorial/netstd/Client/Program.cs b/tutorial/netstd/Client/Program.cs
index 9c47450..f1c5236 100644
--- a/tutorial/netstd/Client/Program.cs
+++ b/tutorial/netstd/Client/Program.cs
@@ -39,10 +39,25 @@
 
 namespace Client
 {
+    public static class LoggingHelper
+    {
+        public static ILoggerFactory LogFactory { get; } = LoggerFactory.Create(builder => {
+            ConfigureLogging(builder);
+        });
+
+        public static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
+        public static ILogger<T> CreateLogger<T>() => LogFactory.CreateLogger<T>();
+    }
+
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new();
-        private static ILogger Logger;
+        private static readonly ILogger Logger = LoggingHelper.CreateLogger<Program>();
         private static readonly TConfiguration Configuration = null;  // new TConfiguration() if  needed
 
         private static void DisplayHelp()
@@ -86,47 +101,35 @@
         {
             args ??= Array.Empty<string>();
 
-            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
-            using (var serviceProvider = ServiceCollection.BuildServiceProvider())
+            if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
             {
-                Logger = serviceProvider.GetService<ILoggerFactory>().CreateLogger(nameof(Client));
+                DisplayHelp();
+                return;
+            }
 
-                if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
-                {
-                    DisplayHelp();
-                    return;
-                }
+            Logger.LogInformation("Starting client...");
 
-                Logger.LogInformation("Starting client...");
-
-                using (var source = new CancellationTokenSource())
-                {
-                    RunAsync(args, source.Token).GetAwaiter().GetResult();
-                }
+            using (var source = new CancellationTokenSource())
+            {
+                RunAsync(args, source.Token).GetAwaiter().GetResult();
             }
         }
 
-        private static void ConfigureLogging(ILoggingBuilder logging)
-        {
-            logging.SetMinimumLevel(LogLevel.Trace);
-            logging.AddConsole();
-            logging.AddDebug();
-        }
-
+        
         private static async Task RunAsync(string[] args, CancellationToken cancellationToken)
         {
             var numClients = GetNumberOfClients(args);
 
-            Logger.LogInformation($"Selected # of clients: {numClients}");
+            Logger.LogInformation("Selected # of clients: {numClients}", numClients);
 
             var transport = GetTransport(args);
-            Logger.LogInformation($"Selected client transport: {transport}");
+            Logger.LogInformation("Selected client transport: {transport}", transport);
 
             var protocol = MakeProtocol( args, MakeTransport(args));
-            Logger.LogInformation($"Selected client protocol: {GetProtocol(args)}");
+            Logger.LogInformation("Selected client protocol: {GetProtocol(args)}", GetProtocol(args));
 
             var mplex = GetMultiplex(args);
-            Logger.LogInformation("Multiplex " + (mplex ? "yes" : "no"));
+            Logger.LogInformation("Multiplex {mplex}", mplex);
 
             var tasks = new Task[numClients];
             for (int i = 0; i < numClients; i++)
@@ -240,7 +243,7 @@
         {
             var numClients = args.FirstOrDefault(x => x.StartsWith("-mc"))?.Split(':')?[1];
 
-            Logger.LogInformation($"Selected # of clients: {numClients}");
+            Logger.LogInformation("Selected # of clients: {numClients}", numClients);
 
             if (int.TryParse(numClients, out int c) && (0 < c) && (c <= 100))
                 return c;
@@ -310,7 +313,7 @@
                 }
                 catch (Exception ex)
                 {
-                    Logger.LogError(ex.ToString());
+                    Logger.LogError("{ex}",ex);
                 }
                 finally
                 {
@@ -319,7 +322,7 @@
             }
             catch (TApplicationException x)
             {
-                Logger.LogError(x.ToString());
+                Logger.LogError("{x}",x);
             }
         }
 
@@ -329,12 +332,12 @@
 
             // Async version
 
-            Logger.LogInformation($"{client.ClientId} Ping()");
+            Logger.LogInformation("{client.ClientId} Ping()", client.ClientId);
             await client.ping(cancellationToken);
 
-            Logger.LogInformation($"{client.ClientId} Add(1,1)");
+            Logger.LogInformation("{client.ClientId} Add(1,1)", client.ClientId);
             var sum = await client.add(1, 1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} Add(1,1)={sum}");
+            Logger.LogInformation("{client.ClientId} Add(1,1)={sum}", client.ClientId, sum);
 
             var work = new Work
             {
@@ -345,13 +348,13 @@
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                Logger.LogInformation("{client.ClientId} Calculate(1)", client.ClientId);
                 await client.calculate(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} Whoa we can divide by 0");
+                Logger.LogInformation("{client.ClientId} Whoa we can divide by 0", client.ClientId);
             }
             catch (InvalidOperation io)
             {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " + io);
+                Logger.LogInformation("{client.ClientId} Invalid operation: {io}", client.ClientId, io);
             }
 
             work.Op = Operation.SUBTRACT;
@@ -360,20 +363,20 @@
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                Logger.LogInformation("{client.ClientId} Calculate(1)", client.ClientId);
                 var diff = await client.calculate(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} 15-10={diff}");
+                Logger.LogInformation("{client.ClientId} 15-10={diff}", client.ClientId, diff);
             }
             catch (InvalidOperation io)
             {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " + io);
+                Logger.LogInformation("{client.ClientId} Invalid operation: {io}", client.ClientId, io);
             }
 
-            Logger.LogInformation($"{client.ClientId} GetStruct(1)");
+            Logger.LogInformation("{client.ClientId} GetStruct(1)", client.ClientId);
             var log = await client.getStruct(1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} Check log: {log.Value}");
+            Logger.LogInformation("{client.ClientId} Check log: {log.Value}", client.ClientId, log.Value);
 
-            Logger.LogInformation($"{client.ClientId} Zip() with delay 100mc on server side");
+            Logger.LogInformation("{client.ClientId} Zip() with delay 100mc on server side", client.ClientId);
             await client.zip(cancellationToken);
         }
 
diff --git a/tutorial/netstd/Interfaces/Interfaces.csproj b/tutorial/netstd/Interfaces/Interfaces.csproj
index 989f6db..a288745 100644
--- a/tutorial/netstd/Interfaces/Interfaces.csproj
+++ b/tutorial/netstd/Interfaces/Interfaces.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <AssemblyName>Interfaces</AssemblyName>
     <PackageId>Interfaces</PackageId>
     <Version>0.16.0.0</Version>
@@ -34,7 +34,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
   </ItemGroup>
 
   <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
diff --git a/tutorial/netstd/Server/Program.cs b/tutorial/netstd/Server/Program.cs
index 80205d5..d9c9dbf 100644
--- a/tutorial/netstd/Server/Program.cs
+++ b/tutorial/netstd/Server/Program.cs
@@ -38,52 +38,54 @@
 using Thrift.Processor;
 using System.Diagnostics;
 
-#pragma warning disable IDE0063  // using
 #pragma warning disable IDE0057  // substr
 
 namespace Server
 {
+    public static class LoggingHelper
+    {
+        public static ILoggerFactory LogFactory { get; } = LoggerFactory.Create(builder => {
+            ConfigureLogging(builder);
+        });
+
+        public static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
+        public static ILogger<T> CreateLogger<T>() => LogFactory.CreateLogger<T>();
+    }
+
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new();
-        private static ILogger Logger;
+        private static readonly ILogger Logger = LoggingHelper.CreateLogger<Program>();
         private static readonly TConfiguration Configuration = null;  // new TConfiguration() if  needed
 
         public static void Main(string[] args)
         {
             args ??= Array.Empty<string>();
 
-            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
-            using (var serviceProvider = ServiceCollection.BuildServiceProvider())
+            if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
             {
-                Logger = serviceProvider.GetService<ILoggerFactory>().CreateLogger(nameof(Server));
-
-                if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
-                {
-                    DisplayHelp();
-                    return;
-                }
-
-                using (var source = new CancellationTokenSource())
-                {
-                    RunAsync(args, source.Token).GetAwaiter().GetResult();
-
-                    Logger.LogInformation("Press any key to stop...");
-
-                    Console.ReadLine();
-                    source.Cancel();
-                }
-
-                Logger.LogInformation("Server stopped");
+                DisplayHelp();
+                return;
             }
+
+            using (var source = new CancellationTokenSource())
+            {
+                RunAsync(args, source.Token).GetAwaiter().GetResult();
+
+                Logger.LogInformation("Press any key to stop...");
+
+                Console.ReadLine();
+                source.Cancel();
+            }
+
+            Logger.LogInformation("Server stopped");
         }
 
-        private static void ConfigureLogging(ILoggingBuilder logging)
-        {
-            logging.SetMinimumLevel(LogLevel.Trace);
-            logging.AddConsole();
-            logging.AddDebug();
-        }
 
         private static void DisplayHelp()
         {
@@ -226,15 +228,12 @@
             try
             {
                 Logger.LogInformation(
-                    string.Format(
-                        "TSimpleAsyncServer with \n{0} transport\n{1} buffering\nmultiplex = {2}\n{3} protocol",
-                        transport,
-                        buffering,
-                        multiplex ? "yes" : "no",
-                        protocol
-                        ));
-
-                var loggerFactory = ServiceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
+                    "TSimpleAsyncServer with \n{transport} transport\n{buffering} buffering\nmultiplex = {multiplex}\n{protocol} protocol",
+                    transport,
+                    buffering,
+                    multiplex ? "yes" : "no",
+                    protocol
+                    );
 
                 var server = new TSimpleAsyncServer(
                     itProcessorFactory: new TSingletonProcessorFactory(processor),
@@ -243,7 +242,7 @@
                     outputTransportFactory: transportFactory,
                     inputProtocolFactory: protocolFactory,
                     outputProtocolFactory: protocolFactory,
-                    logger: loggerFactory.CreateLogger<TSimpleAsyncServer>());
+                    logger: LoggingHelper.CreateLogger<TSimpleAsyncServer >());
 
                 Logger.LogInformation("Starting the server...");
 
@@ -251,7 +250,7 @@
             }
             catch (Exception x)
             {
-                Logger.LogInformation(x.ToString());
+                Logger.LogInformation("{x}",x);
             }
         }
 
@@ -327,7 +326,7 @@
                     .UseUrls("http://localhost:9090")
                     .UseContentRoot(Directory.GetCurrentDirectory())
                     .UseStartup<Startup>()
-                    .ConfigureLogging((ctx,logging) => ConfigureLogging(logging))
+                    .ConfigureLogging((ctx,logging) => LoggingHelper.ConfigureLogging(logging))
                     .Build();
 
                 Logger.LogTrace("test");
@@ -379,7 +378,7 @@
             public async Task<SharedStruct> getStruct(int key,
                 CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStruct({0})", key);
+                Logger.LogInformation("GetStruct({key})", key);
                 return await Task.FromResult(_log[key]);
             }
 
@@ -391,13 +390,13 @@
 
             public async Task<int> add(int num1, int num2, CancellationToken cancellationToken)
             {
-                Logger.LogInformation($"Add({num1},{num2})");
+                Logger.LogInformation("Add({num1},{num2})", num1, num2);
                 return await Task.FromResult(num1 + num2);
             }
 
             public async Task<int> calculate(int logid, Work w, CancellationToken cancellationToken)
             {
-                Logger.LogInformation($"Calculate({logid}, [{w.Op},{w.Num1},{w.Num2}])");
+                Logger.LogInformation("Calculate({logid}, [{w.Op},{w.Num1},{w.Num2}])", logid, w.Op, w.Num1, w.Num2);
 
                 int val;
                 switch (w.Op)
@@ -462,7 +461,7 @@
         {
             public async Task<SharedStruct> getStruct(int key, CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStruct({0})", key);
+                Logger.LogInformation("GetStruct({key})", key);
                 return await Task.FromResult(new SharedStruct()
                 {
                     Key = key,
diff --git a/tutorial/netstd/Server/Server.csproj b/tutorial/netstd/Server/Server.csproj
index e5e54a5..6bee63f 100644
--- a/tutorial/netstd/Server/Server.csproj
+++ b/tutorial/netstd/Server/Server.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Server</AssemblyName>
     <PackageId>Server</PackageId>
@@ -40,6 +40,6 @@
     <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.2.1" />
     <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
-    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
   </ItemGroup>
 </Project>
