2020 Method
Changes 0
M

ExternalService.AddServer

Description:
Registers a server with its service.
Remarks:

Servers must be registered with their services. There has to be at least one server registered for a service in order to be able to execute the service.

A server can be added only once. An attempt to add a server again will lead to an exception. A server cannot be removed during the service's execution or when another server is just being added or removed (e.g. during OnServersChanged call-back to the service).

Adding a server to a service does not make the server active yet. A registered server means it may be used with the service, not that it is going to be automatically used (executed). In order to make a service applicable to its service, the server must set as the active server (or be a part of the set of active servers, in a multi-server service).

Servers can be registered at any time; registering does not need to happen during an application's start-up, but it must happen - naturally - after the respective service has been registered. Since all built-in services are automatically registered during initialization of Revit, their servers can be added as early as during the OnStartup method. Third-party services, on the other hand, get registered during the OnStartup method, therefore their servers need to be added later. The next earliest opportunity for adding servers to a third-party service is on the ApplicationInitialized event.

public void AddServer(
	IExternalServer server
)