Troubleshooting
Configuration Issues
Proxy Server
Often, your server can only access the internet through a proxy server.
If that's the case, make sure your proxy server is listed in the web.config
so the HttpClient
used by Sentry's SDK can pick it up.
<system.net>
<defaultProxy>
<proxy proxyaddress="http://proxy.address.here" bypassonlocal="true" />
</defaultProxy>
</system.net>
TLS 1.2 Support & Windows Server
If you're not able to capture events from ASP.NET to Sentry on older versions of Windows Server, with the older .NET Framework, you must enable TLS 1.2.
using System.Net;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
SentrSdk.Init With Error
If you get the following error during Sentry initialization, you may have a misconfiguration on your Web.config:
System.IO.FileNotFoundException: Could not load file or assembly System.Net.Http, Version=4.0.0.0
You can fix it with one of the three solutions below:
- Find the
assemblyIdentity
forSystem.Net.Http
and remove thebindingRedirect
.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
</dependentAssembly>
- Find the
assemblyIdentity
forSystem.Net.Http
and lower the newVersion to4.0.0.0
.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
- Install the latest package from
System.Net.Http
in NuGet into your project.
You can find more information about the problem in this GitHub issue.
Tags Not Showing if Set on Application_Start
This happens because the scope
from requests
will be different from the one executed during the execution of Application_Start.
To apply Tags
globally, it's recommended that you set them in SentryOptions
, as shown in the example below:
SentrySdk.Init(options =>
{
options.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
options.DefaultTags.Add("TagName", "value");
});
Build Issues
Package Conflict - Conflict with Sentry.DiagnosticsSource
The call is ambiguous between the following methods or properties:
Sentry.SentryOptionsExtensions.DisableDiagnosticSourceIntegration(Sentry.SentryOptions)
and Sentry.SentryOptionsDiagnosticExtensions.DisableDiagnosticSourceIntegration(Sentry.SentryOptions)
The above error means that the version of the Sentry package you are using already contains the DiagnosticSource
integration within itself, but you additionally installed Sentry.DiagnosticSource
, which is only relevant for older framework versions.
To resolve this problem, remove the package reference to Sentry.DiagnosticSource
.
Missing Definition
SentryOptions does not contain a definition for AddDiagnosticSourceIntegration.
The above error could have two meanings:
You're using an outdated SDK (3.8.3 or older).
Your project already includes the integration automatically. You can validate it by observing the debug information from Sentry SDK. Enable it through the options.
Your debug window will have following messages:
Debug: Logging enabled with ConsoleDiagnosticLogger and min level: Debug
Debug: Initializing Hub for Dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0'.
Debug: Using 'GzipBufferedRequestBodyHandler' body compression strategy with level Optimal.
Debug: New scope pushed.
Debug: Registering integration: 'AutoSessionTrackingIntegration'.
Debug: Registering integration: 'AppDomainUnhandledExceptionIntegration'.
Debug: Registering integration: 'AppDomainProcessExitIntegration'.
Debug: Registering integration: 'TaskUnobservedTaskExceptionIntegration'.
Debug: Registering integration: 'SentryDiagnosticListenerIntegration'.
If the debug file contains information about SentryDiagnosticListenerIntegration
, then your project already includes the integration automatically.
- Package:
- nuget:Sentry
- Version:
- 4.9.0
- Repository:
- https://github.com/getsentry/sentry-dotnet