# \[APM\] ASP.Net Agent no span data captured in Elasticsearch

**URL:** <https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [February 10, 2020, 12:34am UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491 "2020-02-10T00:34:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan.xu](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@ryan.xu](https://discuss.elastic.co/u/ryan.xu)\
**Post date:** [February 10, 2020, 12:34am UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/1 "2020-02-10T00:34:35Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** : 7.5.2

**Elasticsearch version** :7.5.2

**APM Server version** :7.5

**APM Agent language and version** : APM .Net Agent, [ASP.net](http://ASP.net)

**Browser version** :Chrome (79.0.3945)

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: RPM / YUM

**Fresh install or upgraded from other version?** Fresh install

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
We have configured .net agent and enabled [asp.net](http://asp.net)(framework) in the .net application (deployed in IIS). the agent directly send data to ElasticSearch. We can see transations. but there is no span data received by Elasticsearch.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/9/590c85ece2164a931a92c5c992e96ab18ea4ccf1.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/e/2ef7212dae4bb08240cca754b485ff3cf836dd3b.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/7/9709091e5bc24ae6f70b07824c3e52e5875edbf0.png)

APM options in web.config:  
add key="ElasticApm:ServerUrls" value="[http://172.16.98.224:8200](http://172.16.98.224:8200)"  
add key="ElasticApm:StackTraceLimit" value="-1"  
add key="ElasticApm:SpanFramesMinDuration" value="-1ms"  
add key="ElasticApm:LogLevel" value="info"

**Steps to reproduce** :  
1.  
2.  
3.

**Errors in browser console (if relevant)**:

**Provide logs and/or server output (if relevant)**:

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 10, 2020, 2:05pm UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/2 "2020-02-10T14:05:04Z")

</div>

Hi @ryan.xu,

I see the transaction name ends with `.html` - what kind of HTTP request is this? What span do you expect there?

If there is not database call or outgoing HTTP call and you don't capture a span manually, then for a static `html` you won't see more than the transaction itself.

---

<div class="post-metadata">

**Author:** ![ryan.xu](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@ryan.xu](https://discuss.elastic.co/u/ryan.xu)\
**Post date:** [February 11, 2020, 1:02am UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/3 "2020-02-11T01:02:58Z")

</div>

Hi GregKalapos,

Thank you for you reply! In fact the page is dynamic content and get data from database. the suffix is changed from aspx to html for kind of SEO purpose. I also checked other type of request with no lucky.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c29aaf647e5d72c824c7b1f98f72d10eb9a4c06b.png)

regards!  
Ryan

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 12, 2020, 6:19pm UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/4 "2020-02-12T18:19:08Z")

</div>

Hi Ryan,

What library do you use to communicate to the database?

We have Entity Framework support, [here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup.html#setup-ef6) is a doc. about how to turn it on.

We currently work on direct `SqlClient` support (without Entity Framework) - that's not yet released.

Greg

---

<div class="post-metadata">

**Author:** ![ryan.xu](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@ryan.xu](https://discuss.elastic.co/u/ryan.xu)\
**Post date:** [February 13, 2020, 11:27am UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/5 "2020-02-13T11:27:32Z")

</div>

Hi Greg,

Tried with no lucky, I'm not sure if something with my code, although I switched from 4.5.x .net framework to 4.6.2.  
Would the .net agent report spans other than entity framework, as I see from the docs, the picture shows spans like strace trace of .net itself, as well as sql spans.  
In my deployment, there's not even 1 record in span index.

Thank you!  
Ryan

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 18, 2020, 10:35pm UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/6 "2020-02-18T22:35:56Z")

</div>

> I switched from 4.5.x .net framework to 4.6.2.

That's good, 4.6.1 is the latest we support, so that was a needed step.

> Would the .net agent report spans other than entity framework

For database we currently only support Entity Framework and Entity Framework core - plus there is an effort to support `SqlClient` as said above.

Could you maybe place the code here from the controller - or at least some part of is, especially the one that calls into the database - If I see it I'll be probably able to tell if there is anything for it.

---

<div class="post-metadata">

**Author:** ![ryan.xu](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@ryan.xu](https://discuss.elastic.co/u/ryan.xu)\
**Post date:** [February 19, 2020, 1:20am UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/7 "2020-02-19T01:20:56Z")

</div>

Hi Greg,

I tried with a brand new project with only 1 web form, to submit data to server and DB, with .net framework 4.6.1 and entityframework. still no span captured.  
Configured as guide, included below config item in web.config

> \<appSettings\>  
> \<add key="ElasticApm:ServerUrls" value="[http://172.16.98.224:8200](http://172.16.98.224:8200)" /\>  
> \<add key="ElasticApm:StackTraceLimit" value="-1" /\>  
> \</appSettings\>  
> \<system.webServer\>  
> \<modules\>  
> \<add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" /\>  
> \</modules\>  
> \</system.webServer\>
> 
> ```
> \<interceptors\>
> \<interceptor type="Elastic.Apm.EntityFramework6.Ef6Interceptor, Elastic.Apm.EntityFramework6" /\>
> \</interceptors\>
> 
> ```

there's only one controller, which is homecontroller

> ```
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Web;
> using System.Web.Mvc;
> using TripStats.Models;
> using TripStats.Services;
> using System.IO;
> using TripStats.Domain;
> 
> namespace TripStats.Controllers
> {
> public class HomeController : Controller
> {
> public ConfigService configService { get; set; } = new ConfigService();
> public TripInfoService tripInfoService { get; set; } = new TripInfoService();
> public IWordService wordService { get; set; } = new WordService();
> 
> // GET: Home
> [HttpGet]
> public ActionResult Index()
> {
> BindData();
> return View();
> }
> 
> [HttpPost]
> [ValidateAntiForgeryToken]
> public ActionResult Index(IndexViewModel model)
> {
> if (ModelState.IsValid)
> {
> TripInfo info = new Domain.TripInfo()
> {
> CName = model.CName,
> Number = model.Number,
> Department = model.Department,
> FactoryArea = model.FactoryArea,
> OriginalIDNumber = model.IDNumber,
> IDNumber = MD5Helper.GetMd5(model.IDNumber),
> OriginalPhoneNumber = model.PhoneNumber,
> PhoneNumber = MD5Helper.GetMd5(model.PhoneNumber),
> HujiProvince = model.HujiProvince,
> HujiCity = model.HujiCity,
> ScreenShotFilePath = configService.ImageSavePath + "\\" + $"{model.FactoryArea}-{model.Department}-{model.CName}-{model.Number}-{Path.GetFileName(model.ScreenShot.FileName)}",
> WordFilePath = configService.WordSavePath + "\\" + $"{model.FactoryArea}-{model.Department}-{model.CName}-{model.Number}-{model.RecordTime.ToString("yyyyMMddHHmmss")}.docx",
> IsAgree = model.IsAgree,
> Signature = model.Signature,
> RecordTime = model.RecordTime,
> };
> 
> if (!string.IsNullOrEmpty(info.ScreenShotFilePath))
> {
> if (System.IO.File.Exists(info.ScreenShotFilePath))
> {
> System.IO.File.Delete(info.ScreenShotFilePath);
> }
> if (model.ScreenShot != null)
> {
> model.ScreenShot.SaveAs(info.ScreenShotFilePath);
> }
> }
> 
> tripInfoService.SaveTripInfo(info);
> wordService.SaveWord(info);
> tripInfoService.DeleteScreenShotFile(info);
> 
> return RedirectToAction("Success");
> }
> BindData();
> return View(model);
> }
> 
> public ActionResult Success()
> {
> return View();
> }
> 
> [HttpGet]
> public ActionResult Test()
> {
> return View();
> }
> 
> public void BindData()
> {
> List<SelectListItem> Departments = new List<SelectListItem>();
> Departments.Add(new SelectListItem() { Text = "生产", Value = "生产" });
> Departments.Add(new SelectListItem() { Text = "生产-启询员工", Value = "生产-启询员工" });
> Departments.Add(new SelectListItem() { Text = "质量", Value = "质量" });
> Departments.Add(new SelectListItem() { Text = "供应链", Value = "供应链" });
> Departments.Add(new SelectListItem() { Text = "客户服务", Value = "客户服务" });
> Departments.Add(new SelectListItem() { Text = "EHSS", Value = "EHSS" });
> Departments.Add(new SelectListItem() { Text = "财务", Value = "财务" });
> Departments.Add(new SelectListItem() { Text = "IT", Value = "IT" });
> Departments.Add(new SelectListItem() { Text = "人力资源和行政", Value = "人力资源和行政" });
> Departments.Add(new SelectListItem() { Text = "工程", Value = "工程" });
> Departments.Add(new SelectListItem() { Text = "技术支持及研发", Value = "技术支持及研发" });
> Departments.Add(new SelectListItem() { Text = "卓越运营", Value = "卓越运营" });
> Departments.Add(new SelectListItem() { Text = "总经办", Value = "总经办" });
> ViewData["Departments"] = Departments;
> }
> }
> }
> 
> ```

Is there anything we missed.

Thank you!  
Ryan

---

<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:** [March 10, 2020, 9:21pm UTC](https://discuss.elastic.co/t/apm-asp-net-agent-no-span-data-captured-in-elasticsearch/218491/8 "2020-03-10T21:21:02Z")

</div>

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