Data Abstract server as a .NET 6 Worker Service

I downloaded the latest version and I don’t see a Worker Service template for the Data Abstract Server. Do you have documentation or an example project?

C# / .NET 6
Visual Studio 2022

Hello

Unfortunately there is no such template atm.

Assuming you need to run your application as a Windows Service you need to do the following steps:

  • Create a new Data Abstract server using the .NET Core template
  • Switch to the new Hosting infrastructure as described in this article ApplicationHost Infrastucture (.NET) , section “Migration to the new Hosting infrastructure”
  • Then reference the Microsoft.Extensions.Hosting.WindowsServices package and replace UseConsoleLifetime call with UseWindowsService in the Program.cs file.

Unfortunately the Microsoft.Extensions.Hosting.WindowsServices package does not provide its own installer so the standard Windows Service installer should be used:

sc create [Service_Name] BinPath=[full_path_to_the_server_app_exe_file]

Also several other commands are available that allow to start, stop or delete the Windows Service:

sc start [Service_Name]

sc stop [Service_Name]

sc delete [Service_Name]

Regards

Logged as bugs://D19248.

I followed the instructions and think the server is basically set up but here are some questions regarding this:

  1. A console window appears when I run the service application. Will a console window pop up when the application is installed and running as a service? Is there any way to turn the console window off?
  2. The client is able to send a query to the Data Abstract server. However, the console window indicates that it is a trial version even though the latest full version is installed on my development PC. Am I missing a step?

From docs:

For example to turn the application into a Windows Service one would need to reference the Microsoft.Extensions.Hosting.WindowsServices package and to replace the UseConsoleLifetime method call with the UseWindowsService method call.

You need to either check app startup command line parameters and call UseConsoleLifetime orUseWindowsService based on startup params (like --console for console mode) or just split the app into 3 projects:

  1. Class Library with services definition and CreateHostBuilder-related code up to the Use** call. I.e. this part of the code:
        return Host.CreateDefaultBuilder(args)
                .ConfigureServices((hostContext, services) =>
                {
                })
                .UseApplicationServer(configuration =>
                {
                })
                .UseNetworkServer(server =>
                {
                })
  1. Then create 2 starter app, one for console, another for windows service (and maybe even 3rd one for SystemD service if needed), call the CreateHostBuilder func and then call the needed Use* method.

Have you ever installed a Trial with the same version # on that host? If so, then you need to delete obj and bin folders if your project app and then clear the NuGet cache in the VS settings. Then VS will redownload NuGet packages into its cache, replacing Trial packages with Full ones

Regards

Sorry, I missed that in the documentation. For my purposes the following is sufficient:

		public static void Main(string[] args)
		{
			IHostBuilder builder = CreateHostBuilder(args);

			if (System.Diagnostics.Debugger.IsAttached)
			{
				builder = builder.UseConsoleLifetime();
			}
			else
            {
				builder = builder.UseWindowsService();
			}

			IHost host = builder.Build();

			host.Run();
		}

I downloaded and installed the software from my product downloads page. I was prompted to enter my user name and password and the license downloaded. Yet when I run the client application I get the message in the image below. I don’t see a license.licx file anywhere but the .NET 6 project is so different I don’t know if this is how the licensing works anymore.

Latest RO/DXA no longer uses the .licx system, as its not supported by .NET Core. instead, we now (as for the other platforms) ship different versions of the .dlls for Trial vs Full.

If you’re getting the trial message, that means you are accidentally still building agianst the Trial version .dlls. Can you check your build log and see where the RO/DA .dll(s) are being referenced from? Also maybe, JIC force a rebuild, in case that ws cached.

Are you using Elements or Visual C#?

Visual Studio Enterprise 2022 (17.1.2)
Visual C# (not Elements)

Unfortunately I have no idea where to find the build log… aside from the Output Window.

I can tell you that the Template created this project initially as .NET Core 3.1 and I changed it to .NET 6.

Then I had to add the NuGet packages to both the client and the server application to get it to build. I also had to add the Microsoft SQL Server and Microsoft Hosting extensions.

If I drill down into the dependencies far enough I see:

C:\Users\my name\.nuget\packages\remobjects.sdk\10.0.0.1537\lib\netcoreapp3.1\RemObjects.SDK.dll
C:\Users\my name\.nuget\packages\remobjects.sdk\10.0.0.1537\lib\netcoreapp3.1\RemObjects.SDK.ZeroConf.dll
C:\Users\my name\.nuget\packages\remobjects.sdk.server\10.0.0.1537\lib\netcoreapp3.1\RemObjects.SDK.Server.dll

Have you ever installed Trial version of Data Abstract with the same version?
If so, then you have to clean the NuGet package cache and then readd the dependencies.

Otherwise NuGet and MSBUIL will take dependencies from internal cache, thus using the Trial version.

Regards

No, I didn’t have a reason to as I own the product. I downloaded from my product downloads and when prompted I entered my login credentials to download my license.

Just for giggles I looked up how to clear the cache and reinstalled the NuGet packages. I’m still getting the warning that it is a trial version.

Logged as bugs://D19250.

bugs://D19250 was closed as fixed.

Yes, found the case why this message is triggered and fixed it.

You need to either wait for the next official build or drop a mail to support@ so we’ll send you a new build once it is available.

Sorry for the inconvenience.

No worries. I am just learning Data Abstract and I’m not in a hurry.

I’ve uploaded the latest version of DA to your Personal Downloads JIC, anyways.

—marc