Loading code first Service from DLL

I’m just starting to learn the Remoting SDK so forgive me if I’m missing something obvious.
I am trying to create a Service DLL (.net 4.8 Class Library) then load it into a server. When I create the service using RODL generated from Service Builder and load it using Assembly.LoadFile(filename), it works fine - you can view the RODL xml in a web browser and use it to create a client without issue.

However, when I create a DLL using code first, the RODL doesn’t appear in the browser. What am I missing?

Hello

The difference is that RODL-based (or Classic) server assembly already contains its RODL as embedded resource. What’s more important, that assembly also contains service invoker code generated based on that RODL. This code is used by Remoting SDK infrastructure to handle incoming service requests.

Code-First services require special registration. This registration is done behind the scenes when the server app is started.

In your case you need to perform this registration by yourself when the assembly is loaded.

This is a quite complicated process (you can see it in the file

RemObjects SDK for .NET\Source\RemObjects.SDK.Server\CodeFirstServices\Configuration.cs

, the

RegisterServices(String rodlName, String rodlNamespace)

method)

So if your server app is based on the ApplicationServer infrastructure or hosting RO SDK packages then the easiest solution is to load your service assembly before the swerver startup code is run.
If your server app is a custom application then you need to load the service assembly (or assemblies) and then call RemObjects.SDK.Server.Configuration.Load() method. It will process the service definitions and register them.

Regards

Thank you for that quick and comprehensive reply. I am not using the ApplicationServer infrastructure, so a call to Configuration.Load() is exactly what I was missing. Now everything works perfectly.

Please note that Configuration.Load() can be called only once during the application life. It won’t be possible to use this method to initialize services if you’ll load one more assembly later.

Thank you for the additional information. That will not be a problem in my application.

You also might be interested in these topics:

https://docs.remotingsdk.com/Servers/Technologies/ApplicationHost/
https://docs.remotingsdk.com/Servers/Technologies/ApplicationServer/
https://docs.remotingsdk.com/Servers/Technologies/DependencyInjection/