# Problem with using APM in asp.net core application

**URL:** <https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907>\
**Category:** APM\
**Tags:** docker, dotnet\
**Created:** [November 28, 2022, 5:37am UTC](https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907 "2022-11-28T05:37:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hassan\_jalali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hassan_jalali/32/110081_2.png) [@Hassan\_jalali](https://discuss.elastic.co/u/Hassan_jalali)\
**Post date:** [November 28, 2022, 5:37am UTC](https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907/1 "2022-11-28T05:37:51Z")

</div>

I'm using **[asp.net](http://asp.net) core and docker** and the goal is to use **Elastic APM** , here is my configuration:

**Program.cs:**

```auto
app.UseAllElasticApm(builder.Configuration);

```

**appsettings.json:**

```auto
"ElasticApm": {
    "ServiceName": "Appraisal360APMSerivce",
    "LogLevel": "verbose",
    "ServerUrl": "http://localhost:8200",
    "apm-server-secret-token": "",
    "TransactionSampleRate": 1.0
  }

```

**docker-compose file:**

```auto
version: '3.4'

services:

  apm-server:
    image: docker.elastic.co/apm/apm-server:7.15.2
    ports:
      - 8200:8200
      - 6060:6060
    volumes:
      - ./apm-server.yml:/usr/share/kibana/config/apm-server.yml
    environment:
      - output.elasticsearch.hosts=["http://elasticsearch:9200"]
    networks:
      - elastic
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E apm-server.host=0.0.0.0:8200
        -E setup.kibana.host=kibana:5601
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    logging:
      driver: 'json-file'
      options:
          max-size: '200m'
          max-file: '50'

  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:8.5.0
    ports:
      - 9200:9200
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=true
  networks:
      - elastic

  kibana:
    container_name: kibana
    image: kibana:8.5.0
    volumes:
      - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    environment:
      - XPACK_MONITORING_ENABLED=true
      - XPACK_MONITORING_COLLECTION_ENABLED=true
      - XPACK_SECURITY_ENABLED=true
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
 ports:
      - 5601:5601
    networks:
      - elastic

  elastic-agent:
    image: docker.elastic.co/beats/elastic-agent:8.5.0
    container_name: elastic-agent
    restart: always
    user: root # note, synthetic browser monitors require this set to `elastic-agent`
    environment:
     - fleet-server-es=http://localhost:9200
     - fleet-server-service-token= *****
     - fleet-server-policy=fleet-server-policy

networks:
  elastic:
    driver: bridge

volumes:
  elasticsearch-data:

```

my **container** is up and running without error

 ![Screenshot 2022-11-28 092045](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f58904c77fa426471359ebbbfb8a94d88ea74a9d.jpeg)

now the problem is here that **fleet server** does not find any **connection** like what u see in the picture:

 ![Screenshot 2022-11-28 091718](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f14f29b7e1e16c9638dec69818b311edbfbc3153.jpeg)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 29, 2022, 4:12am UTC](https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907/2 "2022-11-29T04:12:47Z")

</div>

Hi @Hassan_jalali Welcome to the community!

So lets back up a bit...

If you want to run APM server standalone ... then you do not use Fleet but you still need to load the integration .... Interesting I just help someone solve this here

> [@Standalone apm-server with elasticsearch 8 in docker not able to connect](https://discuss.elastic.co/t/standalone-apm-server-with-elasticsearch-8-in-docker-not-able-to-connect/319892/3):
>
> Ok I got mine working... I think you did not setup / load the APM integration... kibana weird but you still need to do that... you need to do that before you start the APM Server Then I see the assets GET \_cat/indices/.\*?v GET \_cat/templates/tra\* # GET \_cat/indices/.\*?v 200 OK health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .fleet…

But you do not use Fleet + Standalone APM Server

It is important to realize ... That Fleet and APM Integration are just Special Policies / Integration inside and Agent ... APM Integration is the the new APM Server

If you want to use Fleet then do Follow These Documents but this will install fleet on the host not in docker... then install the APM Integrations

> **[Quick start | APM User Guide \[7.17\] | Elastic](https://www.elastic.co/guide/en/apm/guide/7.17/apm-quick-start.html)**

And Seems like you want to run fleet in a container so then you install as docker (which I think is a bit harder) ... you would need to follow these directions to install

> **[Run Elastic Agent in a container | Fleet and Elastic Agent Guide \[7.17\] |...](https://www.elastic.co/guide/en/fleet/7.17/elastic-agent-container.html)**

Yes sorry / confusing... harder than it should be

Take a look at these and then come back...

---

<div class="post-metadata">

**Author:** ![Hassan\_jalali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hassan_jalali/32/110081_2.png) [@Hassan\_jalali](https://discuss.elastic.co/u/Hassan_jalali)\
**Post date:** [November 29, 2022, 5:18am UTC](https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907/3 "2022-11-29T05:18:24Z")

</div>

> [@stephenb](#):
>
> APM Integrations

that's for the time giving sir, gonna tell you the result

---

<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:** [December 20, 2022, 1:19am UTC](https://discuss.elastic.co/t/problem-with-using-apm-in-asp-net-core-application/319907/4 "2022-12-20T01:19:13Z")

</div>

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