FeatBit

How to Debug Feature Flag .NET SDK's Connection Issue

Scenario

One of FeatBit's customers reported that some developers are unable to connect to the FeatBit server using the .NET SDK. They used the .NET Console demo to test. This issue wasn't related to the FeatBit server itself, but rather to the network environment on the customer's side.

In any case, it's important to diagnose the issue when running the app. Here's how to debug the connection issue in the .NET Feature Flag SDK (provided by FeatBit, an open-source feature flag provider compatiable with microsoft FeatureManagement-Dotnet).

Materials used in this article

Steps to debug

  1. As shown in the image below, add the FeatBit server URLs to explicitly specify which endpoints the Feature Flag Server SDK should connect to.

FeatBit Server Urls

  1. The key change: in line 18 of Program.cs, set the minimum log level to Debug.
var consoleLoggerFactory = LoggerFactory.Create(opt => opt.AddConsole().SetMinimumLevel(LogLevel.Debug));

Set Minimum Log Level

  1. Run the Console App example. You'll see additional debug logs in the console. Before performing step 1, the debug log shows that the default WebSocket connection URL is ws://localhost:5100/xxx, which is incorrect.

Debug log

Result

After following these steps, even if the connection issue is not resolved, you can now see the debug logs and understand the issue better. This will help you diagnose the problem. If you can't find the solution on your own, you can share the debug logs with the FeatBit support team to get help.

Ready to use feature flags to expedite your dev and deployment process?