ASP.NET on .NET Framework in IIS 10 Configuration (not working)

Hi,
I wanted to test apm .net but I couldn't run the MVC ASP.NET .net framework (with Profiler Auto instrumentation). Do I need any code changes?

I followed the general steps here for IIS10

Kibana version: 8.5.1

Elasticsearch version: 8.5.1

APM Server version: elastic_apm_profiler_1.18.0

Hi @aysekisik_kisilan,

could you give me more details on the issue you are experiencing?
Do you see anything in Kibana (e.g. Service, metrics but no transactions) or don't you see anything?

The troubleshooting page explains how to collect agent logs. If you could attach those, this would be helpful.

Hi ,
ElasticApmAgentStartupHook logs

No compatible agent for System.Diagnostics.DiagnosticSource 7.0.0.0. Agent not loaded
No Elastic.Apm.StartupHook.Loader.dll assembly loaded. Agent not loaded
Get Elastic.Apm.StartupHook.Loader.Loader type

I am getting this error for APM .net core.
Also Apm .NET framework does not work at all

Thank you

Hi @aysekisik_kisilan,

it looks like you are using DOTNET_STARTUP_HOOKS as well.
However, DOTNET_STARTUP_HOOKS is not yet ready for .NET 7 (see this issue).
However, we are working on that at the moment and a new agent release with .NET 7 support should be available soon.

Are you using the profiler as well? You should not use both approaches (DOTNET_STARTUP_HOOKS and the profiler) in the same process.

1 Like

I'm sorry for the late reply,

I was trying in net 6 for testing. DOTNET_STARTUP_HOOKS then for .NET 7 I guess. thank you.
I saw this here (zero code change setup )(.NET5+)

2).NET Framework 4.6.1+

I am using a simple application for IIS. I was using this for the .NET Framework 4.6.1+
(IIS 10), but Services, traces, and metrics do not show up on APM server.

$appcmd = "$($env:systemroot)\system32\inetsrv\AppCmd.exe"
$appPool = "<application-pool>" 
$profilerHomeDir = "<unzipped directory>" 
$environment = @{
  COR_ENABLE_PROFILING = "1"
  COR_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
  COR_PROFILER_PATH = "$profilerHomeDir\elastic_apm_profiler.dll"
  ELASTIC_APM_PROFILER_HOME = "$profilerHomeDir"
  ELASTIC_APM_PROFILER_INTEGRATIONS = "$profilerHomeDir\integrations.yml"
  COMPlus_LoaderOptimization = "1" 
}

$environment.Keys | ForEach-Object {
  & $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}

This error

[system.application][error] .NET Runtime version 4.0.30319.0 - Failed to load profiler during CoCreateInstance. Profiler CLSID: '{FA65FE15-F085-4681-9B20-95E04F6C03CC}'. HRESULT: 0x800700c1. Process ID (decimal): 3656. Message ID: [0x2504].

Hi @aysekisik_kisilan,

is your application 32-bit by any chance? The Profiler only works for 64-bit applications.

If you need this feature (32-bit), here is a GitHub issue for it. If you leave a comment, this helps us aligning our priorities.

1 Like

this worked. thank you !!

1 Like

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