skip to Main Content

How to fix Event 1310, ASP.NET 4.0.30319.0 warning

There is an Event 1310, ASP.NET 4.0.30319.0 warning that keeps showing up in the Event Viewer. To be precise, it appears every 4 minutes. In this article, you will learn why this is happening and the solution for Event 1310, ASP.NET 4.0.30319.0.

Event 1310, ASP.NET 4.0.30319.0

Let’s look at Event 1310, ASP.NET 4.0.30319.0.

  • Start Event Viewer
  • Expand Windows Logs > Application
  • Filter on Warning and Event ID 1310.
Event 1310 warning

The Event 1310, ASP.NET 4.0.30319.0 warning:

Event code: 3008 
Event message: A configuration error has occurred. 
Event time: 9/3/2022 10:20:37 AM 
Event time (UTC): 9/3/2022 8:20:37 AM 
Event ID: cd4d829ae8a8448ab61bcfaed9ee26c4 
Event sequence: 1 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/3/ROOT/API-11-133066668371234139 
    Trust level: Full 
    Application Virtual Path: /API 
    Application Path: C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\rest\ 
    Machine name: EX01-2019 
 
Process information: 
    Process ID: 15624 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\SYSTEM 
 
Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework. (C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\rest\web.config line 114)
   at System.Web.Compilation.MultiTargetingUtil.ValidateTargetFrameworkMoniker(String targetFrameworkMoniker)
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName()
   at System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized()
   at System.Web.Compilation.BuildManager.Initialize()
   at System.Web.Compilation.BuildManager.InitializeBuildManager()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

 
 
Request information: 
    Request URL: https://localhost:444/api/v1.0/users/HealthMailbox4d3f8d4952d346cc859e58dd31d62577@exoip.com/Messages?$top=1 
    Request path: /api/v1.0/users/HealthMailbox4d3f8d4952d346cc859e58dd31d62577@exoip.com/Messages 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: NT AUTHORITY\SYSTEM 
 
Thread information: 
    Thread ID: 9 
    Thread account name: NT AUTHORITY\SYSTEM 
    Is impersonating: False 
    Stack trace:    at System.Web.Compilation.MultiTargetingUtil.ValidateTargetFrameworkMoniker(String targetFrameworkMoniker)
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName()
   at System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized()
   at System.Web.Compilation.BuildManager.Initialize()
   at System.Web.Compilation.BuildManager.InitializeBuildManager()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)
 
 
Custom event details: 

Why do we get this warning, and what is the solution for Event 1310, ASP.NET 4.0.30319.0?

Check .NET Framework registry keys

Start Registry Editor and go to the below two paths.

Path 1:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319

There are no subkeys present.

Event 1310 path 1 before

Path 2:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319

There are no subkeys present.

Event 1310 path 2 before

Checking both paths, we see that there are no subfolders, which there should be.

Solution for Event 1310, ASP.NET 4.0.30319.0

Now that we gathered the information, let’s apply the .NETFramework v4.0.30319 registry keys and their values.

Step 1. Download the below two registry files:

  1. .NET Framework v4.0.30319
  2. .NET Framework v4.0.30319 (WOW6432Node)

Step 2. Double-click the registry files so they get added to the registry.

Step 3. Verify that the subkeys are present in below two paths.

Path 1:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319

The subkeys are present.

Event 1310 path 1 after

Path 2:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319

The subkeys are present.

Event 1310 path 2 after

Do the same for the .NET Framework 2.0.50727 registry files. Download them from below:

  1. .NET Framework v2.0.50727
  2. .NET Framework v2.0.50727 (WOW6432Node)

Note: We recommend downloading both .NET Framework v4.x and .NET Framework 2.x registry files and applying them to the registry. This will keep them both identical.

Now that the registry keys and values are applied, it fixes Event 1310, ASP.NET 4.0.30319.0. But we are not done yet. It’s best to enable TLS 1.2 and disable the older TLS protocols.

Set TLS settings

Run the Set-ExchangeTLS.ps1 PowerShell script to set the best practice TLS settings for Exchange Server:

  1. Enable TLS 1.2
  2. Enable TLS 1.2 for .NET 4.x
  3. Enable TLS 1.2 for .NET 3.5
  4. Disable TLS 1.0
  5. Disable TLS 1.1
  6. Disable TLS 1.3

You can adjust the script if you want to set different TLS settings on your Windows server. For example, you might want to enable TLS 1.3 on Windows Server, and you are not running Exchange Server, but you have this error.

Note: Once the TLS configuration is applied, you must restart the Windows Server for the changes to take effect.

Read more in the article Configure Exchange Server TLS settings.

Get TLS settings

An excellent way to check the TLS settings is to run the Exchange Health Checker script.

Go to the TLS section and verify that everything looks good.

Suppose you don’t have Exchange Server; you can run the Get-TLS.ps1 PowerShell script.

Function Get-RegValue {
    [CmdletBinding()]
    Param
    (
        # Registry Path
        [Parameter(Mandatory = $true,
            Position = 0)]
        [string]
        $RegPath,

        # Registry Name
        [Parameter(Mandatory = $true,
            Position = 1)]
        [string]
        $RegName
    )
    $regItem = Get-ItemProperty -Path $RegPath -Name $RegName -ErrorAction Ignore
    $output = "" | select Path, Name, Value
    $output.Path = $RegPath
    $output.Name = $RegName

    If ($regItem -eq $null) {
        $output.Value = "Not Found"
    }
    Else {
        $output.Value = $regItem.$RegName
    }
    $output
}

$regSettings = @()
$regKey = 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319'
$regSettings += Get-RegValue $regKey 'SystemDefaultTlsVersions'
$regSettings += Get-RegValue $regKey 'SchUseStrongCrypto'

$regKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319'
$regSettings += Get-RegValue $regKey 'SystemDefaultTlsVersions'
$regSettings += Get-RegValue $regKey 'SchUseStrongCrypto'

$regKey = 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727'
$regSettings += Get-RegValue $regKey 'SystemDefaultTlsVersions'
$regSettings += Get-RegValue $regKey 'SchUseStrongCrypto'

$regKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727'
$regSettings += Get-RegValue $regKey 'SystemDefaultTlsVersions'
$regSettings += Get-RegValue $regKey 'SchUseStrongCrypto'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client'
$regSettings += Get-TLS12RegValue $regKey 'Enabled'
$regSettings += Get-TLS12RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client'
$regSettings += Get-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $regKey 'DisabledByDefault'

$regSettings

This is how the PS output looks in our example after running the Get-TLS.ps1 script.

Path                                                                                       Name                     Value
----                                                                                       ----                     -----
HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319                                          SystemDefaultTlsVersions     1
HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319                                          SchUseStrongCrypto           1
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319                              SystemDefaultTlsVersions     1
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319                              SchUseStrongCrypto           1
HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727                                          SystemDefaultTlsVersions     1
HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727                                          SchUseStrongCrypto           1
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727                              SystemDefaultTlsVersions     1
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727                              SchUseStrongCrypto           1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server Enabled                      0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server DisabledByDefault            1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client Enabled                      0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client DisabledByDefault            1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server Enabled                      1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server DisabledByDefault            0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client Enabled                      1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client DisabledByDefault            0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server Enabled                      0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server DisabledByDefault            1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server Enabled                      0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server DisabledByDefault            1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client Enabled                      0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client DisabledByDefault            1

Verify Event ID 1310 warnings do not appear

Start Event Viewer > Windows Logs > Application. Filter on Warning and Event ID 1310. Verify that the Event ID does not occur anymore.

Conclusion

You learned how to fix Event 1310, ASP.NET 4.0.30319.0. First, add the .NET Framework registry keys to the registry. After that, configure the TLS settings. As of last, reboot the Windows Server. This can happen on any Windows Server. In this case, it was on the Exchange Server.

Did you enjoy this article? You may also like A fatal error occurred while creating a TLS client credential. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published.