---
title: "Troubleshooting"
description: "Learn more about how to troubleshoot common issues with the ASP.NET SDK."
url: https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting/
---

# Troubleshooting | Sentry for ASP.NET

## [Configuration Issues](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#configuration-issues)

### [Proxy Server](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#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.

```xml
<system.net>
    <defaultProxy>
      <proxy
      proxyaddress="http://proxy.address.here"
      bypassonlocal="true"
    />
    </defaultProxy>
</system.net>
```

### [TLS 1.2 Support & Windows Server](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#tls-12-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.

```bash
using System.Net;

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
```

### [SentrSdk.Init With Error](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#sentrsdkinit-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` for `System.Net.Http` and remove the `bindingRedirect`.

```xml
<dependentAssembly>
  <assemblyIdentity
    name="System.Net.Http"
    publicKeyToken="b03f5f7f11d50a3a"
    culture="neutral"
  />
</dependentAssembly>
```

* Find the `assemblyIdentity` for `System.Net.Http` and lower the newVersion to `4.0.0.0`.

```xml
<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](https://github.com/dotnet/runtime/issues/24382).

### [Tags Not Showing if Set on Application\_Start](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#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:

```csharp
SentrySdk.Init(options =>
{
  options.Dsn = "___PUBLIC_DSN___";
  options.SendDefaultPii = true;
  options.DefaultTags.Add("TagName", "value");
});
```

## [Build Issues](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#build-issues)

### [Package Conflict - `Conflict with Sentry.DiagnosticsSource`](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#package-conflict---conflict-with-sentrydiagnosticssource)

```bash
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](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#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.](https://docs.sentry.io/platforms/dotnet/guides/aspnet/configuration/options.md#debug)

Your debug window will have following messages:

```bash
Debug: Logging enabled with ConsoleDiagnosticLogger and min level: Debug
Debug: Initializing Hub for Dsn: '___PUBLIC_DSN___'.
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.

### [Implicit Usings](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#implicit-usings)

From version 3.14.0, Sentry will respect [Implicit Usings](https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview#implicit-using-directives). This means is Implicit Usings is enabled (`<ImplicitUsings>enable</ImplicitUsings>` or `<ImplicitUsings>true</ImplicitUsings>`) then `Sentry` will be added to the current global using directives. This means that `using Sentry;` can be omitted from any `.cs` files.

In some scenarios Implicit Usings can result in type name conflicts. For example `Session` may exist in multiple namespaces. This can be resolved by fully qualifying the type inline (`Sentry.Session`), or with a [using alias](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive#using-alias):

```bash
using SentrySession = Sentry.Session;
```

Then `SentrySession` can be used instead of `Sentry.Session`.

### [Visual Studio Hot Restart Incompatibility](https://docs.sentry.io/platforms/dotnet/guides/aspnet/troubleshooting.md#visual-studio-hot-restart-incompatibility)

Attempting to build a .NET MAUI iOS app will result in an error if you use Visual Studio Hot Restart when developing on Windows with a remote Mac:

> The xcframework sentry.bindings.cocoa\5.0.1\lib\net8.0-ios17.0\Sentry.Bindings.Cocoa.resources.zip has an incorrect or unknown format and cannot be processed.

This happens because Hot Restart does not support static iOS libraries or frameworks containing static libraries, as detailed in the [Microsoft documentation](https://learn.microsoft.com/en-us/dotnet/maui/ios/hot-restart?view=net-maui-9.0#limitations).
