Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APM causes error 500 in IIS site #250

Closed
L1qu1d1c3 opened this issue Jan 19, 2019 · 10 comments
Closed

APM causes error 500 in IIS site #250

L1qu1d1c3 opened this issue Jan 19, 2019 · 10 comments

Comments

@L1qu1d1c3
Copy link

L1qu1d1c3 commented Jan 19, 2019

Describe the bug
When I install DD APM for .NET Core X64 v4.1.0.0, my app suddenly starts giving 500 Errors (Internal Server Error). My App Pool has is an app that runs on port 5007. If I start the application using cmd with "dotnet app.dll", it loads up just fine, I can access the web/app as expected. So, when I use IIS, it doesn't work, but with dotnet cmd, it does.

To Reproduce
Have a .NET Core 4.1.0.0 app running on port 5007
Install APM
Stop/Start IIS using commands net stop was /y - net start w3svc provided by the guide.
Try to access the website

Expected behavior
My default IIS app to work

Screenshots
If applicable, add screenshots to help explain your problem.

Runtime environment (please complete the following information):

  • Instrumentation mode: tried both
  • Tracer version: DatadogDotNetTracing-0.7.0-x64.msi
  • OS: Windows Server 2016 Datacenter
  • CLR: .NetCore 4.1.0.0

Additional context
I changed the installed to include the Nuget package Datadog.Trace.ClrProfiler.Managed but it just ends up telling me that "website name cannot be empty"

@lucaspimentel
Copy link
Member

lucaspimentel commented Jan 22, 2019

Hey, @L1qu1d1c3. From your last comment in "Additional context," it looks like you originally didn't reference the Datadog.Trace.ClrProfiler.Managed NuGet package in your application. This is a necessary step for now in .NET Core so our managed libraries get deployed with your app. (In .NET Framework, we can deploy it to the GAC using the MSI installer.)

Did the 500 errors stop then you added the Datadog.Trace.ClrProfiler.Managed NuGet package? Where are you seeing the "website name cannot be empty" message? This is not one of our error messages. Can you provide a minimal project that reproduces this issue?

Also (and this is probably not important for this issue), but I'm not sure what you mean by ".NET Core 4.1" since .NET Core is only up to 2.2.x (and a 3.0 preview). For reference:

@L1qu1d1c3
Copy link
Author

L1qu1d1c3 commented Jan 22, 2019

Hi @lucaspimentel ,

I implemented the Nuget Package and i'm getting the following issues:

2019-01-22 16:07:48.6164 | Application startup exception | Fatal  | System.AggregateException: One or more errors occurred. (Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.) ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
   at Datadog.Trace.ClrProfiler.Integrations.AdoNetIntegration.ExecuteDbDataReaderAsync(Object this, Int32 behavior, Object cancellationTokenSource)
   at System.Data.Common.DbCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at System.Data.Common.DbCommand.ExecuteReaderAsync(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.<GetAppliedMigrationsAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<MigrateAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Ids.xxx.Startup.<InitializeDatabaseAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Ids.xxx.Startup.<>c__DisplayClass9_0.<<Configure>b__0>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Ids.xxx.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.InjectApiVersionRoutePolicy.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
---> (Inner Exception #0) System.IO.FileNotFoundException: Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
   at Datadog.Trace.ClrProfiler.Integrations.AdoNetIntegration.ExecuteDbDataReaderAsync(Object this, Int32 behavior, Object cancellationTokenSource)
   at System.Data.Common.DbCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at System.Data.Common.DbCommand.ExecuteReaderAsync(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.<GetAppliedMigrationsAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<MigrateAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Ids.xxx.Startup.<InitializeDatabaseAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Ids.xxx.Startup.<>c__DisplayClass9_0.<<Configure>b__0>d.MoveNext()<---

I am unable to start the application because of this. I'm using version 0.7.0.0-beta of the ClrProfiler.

I've contacted support directly and created a ticket with them,

@lucaspimentel
Copy link
Member

@L1qu1d1c3: Can you confirm which version of .NET your application targets at build time (see <TargetFramework> in the csproj file) and which version(s) of the runtime are installed on the host?

I think there's some kind of mix up going on here. The Datadog.Trace.ClrProfiler.Managed NuGet package targets three different frameworks: netstandard2.0, net45, and net461. The netstandard2.0 assembly references System.Data.Common.dll while the net45/net461 assemblies reference System.Data.dll, which is the one in the error message:

Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.

@L1qu1d1c3
Copy link
Author

@lucaspimentel , targetted framework is <TargetFramework>net461</TargetFramework>

@lucaspimentel
Copy link
Member

lucaspimentel commented Jan 22, 2019

@L1qu1d1c3: I'm sorry, but <TargetFramework>net461</TargetFramework> is .NET Framework 4.6.1, but you said your app runs on .NET Core. Both frameworks are very different internally and we need to know which one you are using (and which version) to be able to provide useful support. See this article for more information on target frameworks.

At the moment, my best guess is that you have multiple projects with mixed targets (.NET Framework, .NET Core, .NET Standard), which could be causing the final application to reference the wrong System.Data assembly.

I've heard of similar issues happening with System.Net.Http:

(edit: add links to similar issues with System.Net.Http and link to target frameworks article)

@L1qu1d1c3
Copy link
Author

Hi @lucaspimentel , my apologies, we have 2 projects and one of them is in net461, the other is .net core
<TargetFramework>netcoreapp1.1</TargetFramework>

For the project with net461, i was using the tracer for IIS, which doesn't work aswell.

@L1qu1d1c3
Copy link
Author

Hi @lucaspimentel ,
i'd like to update this issue:
I've gotten it to work with .net core and it's nuget package. The issue i'm having now is with IIS sites because i'm using net461.

Thank you

@lucaspimentel
Copy link
Member

@L1qu1d1c3: let's handle this through the ticket you created with the Support team

@odyth
Copy link

odyth commented Jun 16, 2022

what was the resolution to this? I'm also having this problem, just started too.

@pierotibou
Copy link
Collaborator

pierotibou commented Jun 16, 2022

Hello @odyth, Thanks for reaching out. I haven't found all the details of the related support ticket unfortunately.
Nevertheless, would you mind explaining the exact issue on your end and your setup (framework, tracer version). Can you also activate the debug logs to see if you have specific errors that could indicate the cause of the issue?
Anyhow, I'd invite you to open a new issue or a support ticket cause the underlying issues may be different anyway and it will ease the follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants