Service Insight missing message body

Hello.

I just installed Service Control (4.3.0) on a server and enabled an Audit instance as well. I changed the host name of the Service Control instance from “localhost” to the computer name, aware of the possibility for anonymous access (fine in this case), but forgot to change the Audit instance Host name, so it was still defaulted to “localhost”.

From my developer machine, I connected Service Insight to this computer and I got all the endpoints and saw the messages as well. However, I couldn’t see the message body so after a while I fired up Fiddler and saw that the call to the computer_name:33333/api/messages/MESSAGE-ID/body returned a 400 BAD REQUEST: “Bad Request - Invalid Hostname”

image

Strange, as all the other calls to the same hostname worked. Then I logged in to the server again and looked at the configuration and saw that the host name for the Audit instance was “localhost” so I changed that one to the computer name as well.

I tested the api-call to the messages (/body) endpoint in Postman and it worked, I got the message body back.

However, when starting Service Insight again, I didn’t see any messages at all! All the searches returned 0 messages. Looking in Fiddler, I can see that the call to /api/messages… (without the /body) returns nothing:

The call to /endpoints/ returned correctly, so I saw all the endpoints in Service Insight, but all had 0 messages.

But the call to /api/messages/MESSAGE_ID/body works now (from Postman)… but not very useful when I can’t see any messages in SI.

So to summarize:

  • If I leave the configured host name of the Audit instance to “localhost”, I can see messages (metadata) in Service Insight but not the message body.
  • If I change the configured host name of the Audit instance to “computer_name”, I can’t see any messages in Service Insight, but I can fetch the message body (via Postman).

Any ideas?

//J

Hi @jens

Is there anything related to this behavior logged in the ServiceControl logs? Can you also include all the details of the empty /messages response when using computer name as host name i.e. all request and response headers and the body text?

Thanks,
Szymon

Sorry for late reply, been away on vacation for a couple of days.

I can now see in the Service Control logs the following exception when using the computer name as host in the Audit instance:

2019-09-03 08:27:24.6486|172|Warn|ServiceControl.CompositeViews.Messages.ScatterGatherApi`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Collections.Generic.IList`1[[ServiceControl.CompositeViews.Messages.MessagesView, ServiceControl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]|Failed to query remote instance at http://localhost:44444/api/.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at ServiceControl.CompositeViews.Messages.ScatterGatherApi`2.<ParseResult>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ServiceControl.CompositeViews.Messages.ScatterGatherApi`2.<FetchAndParse>d__19.MoveNext()

The interesting bit is:

Failed to query remote instance at http://localhost:44444/api/.

It seems like the Service Control instance doesn’t know that the Audit instance has changed its host from localhost to the computer name. However, it might be something on the server because it feels like it should be able to reach localhost from itself?

Edit: Both the Service Control instance and the Service Control Audit instance now uses the computer name as host in the configuration.

Edit2: When trying to access localhost from the server itself I get the 400 - Bad Request message.

//J

Ok, weird… I just removed all my SC instances and added new, this time I used COMPUTER_NAME as host directly (last time I forgot and edited the instances).

This time it all works! So it might be something related to when changing host after the instances were created?