# Unable connect to a .Net 5 project using cloudconnectionpool

**URL:** <https://discuss.elastic.co/t/unable-connect-to-a-net-5-project-using-cloudconnectionpool/314910>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 22, 2022, 4:33am UTC](https://discuss.elastic.co/t/unable-connect-to-a-net-5-project-using-cloudconnectionpool/314910 "2022-09-22T04:33:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrimdog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shrimdog/32/82044_2.png) [@shrimdog](https://discuss.elastic.co/u/shrimdog)\
**Post date:** [September 22, 2022, 4:33am UTC](https://discuss.elastic.co/t/unable-connect-to-a-net-5-project-using-cloudconnectionpool/314910/1 "2022-09-22T04:33:28Z")

</div>

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](https://us1.discourse-cdn.com/elastic/original/3X/0/0/0068d25f26d472f6f917142fe7d4b72b6e016619.png)

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

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

```auto
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);
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 20, 2022, 4:33am UTC](https://discuss.elastic.co/t/unable-connect-to-a-net-5-project-using-cloudconnectionpool/314910/2 "2022-10-20T04:33:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
