I used OpenAPI Generator to generate a C# client for the Thingsboard REST API. I then used this client to build an application for automatically creating devices and writing telemetry data into Thingsboard.
When I work from home and connect to my company network via a VPN, my application works just fine and is reasonably fast. However, when I work on site I noticed that every single http request towards Thingsboard (hosted on a VM in our company network) takes literally forever (up to 30 seconds) and I have no idea, why. It does not matter which API function or endpoint I call, they are all slow.
I already debugged this to the point where I can say for sure that the delay is caused somewhere inside this function call which is implemented in RestSharp.RestClient
:
response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);
As this is deep inside the auto generated client code, I don't really know how to debug this any further. One important thing I noticed is that this problem is 100% limited to the application itself, and not to my whole system/connection. For example, when I call the API via Postman or directly in my browser, it works just fine and I get a response within less than 1 second.
What could be causing this problem and how can I debug it further?