Unable connect to a .Net 5 project using cloudconnectionpool

Hi Everyone
I wanted to use cloudconnectionpool to connect my local .Net 5 project using NEST API since I have deployed elastic cloud. I have posted some sample data into the Elasticsearch using postman and it works when I test it in kibana dev console. But when I tried to run the local .Net 5 projects using swagger to get the data, it showed 404.
image

If anyone can provide some suggestions I would really appreciate it!

I have put codes inside the startup.cs as follow.

public void ConfigureServices(IServiceCollection services){
 ...
 string elasticUserName = "elastic";
 string elasticPassword = "password";
  string defaultIndexName = "post";
  string cloudId = "cloudId"
var crendentials = new BasicAuthenticationCredentials(elasticUserName, elasticPassword);
            var pool = new CloudConnectionPool(cloudId, crendentials);
            var settings = new ConnectionSettings(pool)
                                .EnableDebugMode()
                                .EnableHttpCompression()
                                .PrettyJson();
            var client = new ElasticClient(settings);
}