Host name (as obtained from the HostInformation public API) is not changed and always defaults to Environment.MachineName.
One of the places where this is clearly visible is the heartbeats feature. The heartbeat messages carry the wrong value.
Versions
The problem has been discovered in NServiceBus 8.2 but likely exists in all V8 and V9 versions
Steps to reproduce
Override the host name using config.UniquelyIdentifyRunningInstance().UsingHostName("MyHost")
Add the heartbeat plugin
Run the endpoint using the Learning Transport
Observe the Host filed in the heartbeat messages being set to the default value -- Environment.MachineName
Relevant log output
No response
Additional Information
Workarounds
The workaround in V8 is to use the legacy deprecated API:
#pragma warning disable CS0618 // Type or member is obsolete
RuntimeEnvironment.MachineNameAction = () => "MyMachine";
#pragma warning restore CS0618 // Type or member is obsolete
Possible solutions
Additional information
Combined with a bug in the heartbeat state machine handling in ServiceControl this issue leads to an endless loop of heartbeat stopped-heartbeat restored events generated by ServiceControl after one of the monitored endpoints is upgraded from NServiceBus 7 to NServiceBus 8 and re-deployed.
Describe the bug
Description
Overriding the hostname using the API introduced in NServiceBus 8
does not change the host name.
Expected behavior
Host name is set to the desired value.
Actual behavior
Host name (as obtained from the
HostInformation
public API) is not changed and always defaults to Environment.MachineName.One of the places where this is clearly visible is the heartbeats feature. The heartbeat messages carry the wrong value.
Versions
The problem has been discovered in NServiceBus 8.2 but likely exists in all V8 and V9 versions
Steps to reproduce
config.UniquelyIdentifyRunningInstance().UsingHostName("MyHost")
Environment.MachineName
Relevant log output
No response
Additional Information
Workarounds
The workaround in V8 is to use the legacy deprecated API:
Possible solutions
Additional information
Combined with a bug in the heartbeat state machine handling in ServiceControl this issue leads to an endless loop of heartbeat stopped-heartbeat restored events generated by ServiceControl after one of the monitored endpoints is upgraded from NServiceBus 7 to NServiceBus 8 and re-deployed.