About this guide
In this guide, you will learn how to run the example Hello SiLA server in the repo. The application is a .NET Core server application. The application does not interact with any underlying physical instrument, but rather simulates. The goal of this tutorial is to solidify the concepts of SiLA 2 and understand what is required to implement a SiLA 2 server.
At the end of this guide, you should be capable of running the server and interact with its exposed features via the SiLA 2 Browser.
There are currently two C# implementations of the SiLA 2 specification:
sila_csharp: community developed a reference implementation
- Useful if you would like to be able to create features first, and then from features implement servers.
sila_tecan: A fork of sila_csharp with a different developer philosophy proudly brought to you by Tecan
- It gives you the possibility to build your instrument interfaces first and then automatically generate the class interfaces for your instrument/device.
To follow the steps in this tutorial, you will need the following:
- Access to a terminal window and some familiarity with the command line it provides (e.g. cmd.exe, PowerShell, Bash, zsh)
- .NET Core SDK 2.0 or greater (Linux only supports .NET Core 2.0 or .NET Core 3.0 Preview)
- .NET Framework 4.7.2 SDK
- Git and Git LFS
Windows Installation Instructions
Warning: Do not use .net Core v2.1 on Linux, there is a known problem with port reusability that cause problem with the mDNS discovery. Please use version 2.0. This problem will be fixed in version 3.0 on Linux.
The following set of installation instructions require Chocolatey to be installed. As this will facilitate the installation process. If you cannot install using
choco then please install the tools in the steps manually.
Install .NET Core
choco install dotnetcore-sdk
choco install git git lfs install
On Microsoft Windows the sample applications can also be built and run using Visual Studio. This requires Visual Studio 2017 (Version 15.3 or higher). There are also free editions of Visual Studio like Express or Community Edition.
Verify your pre-requisites
Open a terminal window on your system
If dotnet core is installed then
dotnet --version should return the version of dotnet core SDK installed.
Verify Git is installed by execution
Verify Git LFS is installed
Clone the sila_csharp repository
In this section, we will clone the SiLA C# code repository to your workstation.
In your browser (Chrome recommended), open the sila_csharp code repository
In your terminal clone the repository onto your system
git clone https://gitlab.com/SiLA2/sila_csharp.git
- In your terminal change the directory into the top of the sila_csharp directory by entering:
- In your terminal initialize the submodules by entering:
git submodule update --init --recursive
- Take a minute to review the files and subdirectories in the
ls command (or
dir in cmd) to list the contents
|examples||Example SiLA 2 server implementations which showcase SiLA 2 features|
|servers||Actual SiLA 2 server implementations which interact with physical instruments|
|src||SiLA 2 C# library reference implementation|
|README.md||Contains a reference on how to get started with building, running and developing the SiLA library|
|sila_base||The base resources common between reference implementation derived from SiLA Part A|
|docs||Additional documentation on how to develop the|
|tools||Tools for developing SiLA2 servers|
Build the project
Now that you have successfully cloned the
sila_csharp repository. You can run some of the example servers. Before you can run the example servers you must build the solution with Dotnet CLI to install all the dependent packages.
- Make sure you are in the root directory of the project
- In the terminal enter
dotnet buildto kick-off the build
If no errors pop up when you are all good to continue! Otherwise, contact a maintainer!
Start the Hello SiLA Server
- Start the Hello SiLA Server by entering:
cd examples/HelloSila/HelloSila.ServerApp/bin/Debug/netcoreapp2.0 dotnet HelloSila.ServerApp.dll -c config.json
Alternatively you can also start from the project root folder (with implicit build)
cd examples/HelloSila/HelloSila.ServerApp dotnet run -- -c config.json
dotnet program will start the application and run the server with discovery disabled with a warning as such:
... 11:30:10 | Warn | SiLA2Server..ctor | Server is running without Discovery! ...
Start the SiLA 2 Browser by following the steps here
Manually add the SiLA Server to the browser by following this video
NOTE: SiLA 2 servers runs by default on port 50052.
Shut down the server
Re-enable the server with discovery enabled
Start the Hello SiLA Sever with Discovery enabled
Now that you have been able to run the server and interact with it via the SiLA Browser by manually adding the server. It is now time to test out a very powerful feature of SiLA 2, SiLA Discovery.
Identify the network interface to use. For example, let's assume the found network interface is called
Start the Hello SiLA Server specifying the network interface to connect to by entering:
cd examples/HelloSila/HelloSila.ServerApp/bin/Debug/netcoreapp2.0 dotnet HelloSila.ServerApp.dll -c config.json -n wlp1s0
cd examples/HelloSila.ServerApp dotnet run -- -c config.json -n wlp1s0
Start the SiLA 2 Browser by following the steps here
you should be able to
Scan the networkand discover your Server on the browser
Finding Network Interface on Windows-based OS's
Finding the network interface on a windows machine is not as simple as on *nix based systems. There is no off the shelf tool which lists the correct interface names. Therefore we will run the example servers such that they list the available interfaces.
Identify the IP range of the network (which your the machine is connected to) you would like to expose the SiLA 2 server.
Then list all the available network interfaces on your machine using the Test Server
dotnet HelloSila.ServerApp.dll -l
dotnet run -- -l
You should see some output that looks like:
Available Network Interfaces: lo lo Loopback 000000000000 Unknown 127.0.0.1 , ::1 , enp2s0f1 enp2s0f1 Ethernet 80FA5B5216D9 Down wlp1s0 wlp1s0 Ethernet CC2F71AEB267 Up 10.6.16.181 , fe80::d259:1a4f:37ad:4140%3 , docker0 docker0 Ethernet 0242A5906EFB Down 172.17.0.1 ,
- Select the interface name which has an IP assigned within the desired range.
For the example above, it is
wlp1s0 which is the network interface of interest.