Provides functionality that the service will require throughout its lifetime.

C# |
public sealed class ServiceContext

All Members | Methods | Properties | |||
Icon | Member | Description |
---|---|---|
![]() | ApplicationName | Gets the name of the application. |
![]() | ConsumerId | Gets the consumer ID. |
![]() | ControlCode | Sets a service control code for service instance manager. |
![]() | DeployDirectory | Gets the deployment directory. |
![]() | LastInterruptEvent | Gets the current interrupt event. |
![]() | LogDirectory | Gets the log directory. |
![]() | Publish(ResourceAttribute, Boolean) | Publishes the attribute to the system. |
![]() | Publish(ResourceAttribute) | Publishes the attribute to the system. |
![]() | ServiceName | Gets the service name. |
![]() | ServiceToSlotRatio | Gets the service to slot ratio for this service instance, which indicates how many slots this service is consuming. |
![]() | Unpublish(ResourceAttribute, Boolean) | Un-publishes the attribute from the system. |
![]() | Unpublish(ResourceAttribute) | Un-publishes the attribute from the system. |

This object will be passed to a service instance when it is created. The service instance may choose to cache a reference to this object and call on it at anytime it requires.
NOTE: If any of the methods of this class are called after the Main(...) method exits, the client or service process may behave in an undefined manner (for example, hang or terminate abnormally).

Object | |
![]() | ServiceContext |

[ServiceContainer.onCreateService]