当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

作者:精品下载站 日期:2024-12-14 18:40:54 浏览:13 分类:玩电脑

如何修复事件 1310、ASP.NET 4.0.30319.0 警告


事件查看器中不断显示事件 1310,ASP.NET 4.0.30319.0 警告。准确来说,每4分钟出现一次。在本文中,您将了解发生这种情况的原因以及事件 1310、ASP.NET 4.0.30319.0 的解决方案。

事件 1310,ASP.NET 4.0.30319.0

让我们看看事件 1310,ASP.NET 4.0.30319.0。

  • 启动事件查看器

  • 展开Windows 日志 > 应用程序

  • 过滤警告事件 ID 1310

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

事件 1310,ASP.NET 4.0.30319.0 警告:

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/[email protected]/Messages?$top=1 
    Request path: /api/v1.0/users/[email protected]/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: 

为什么我们会收到此警告?事件 1310、ASP.NET 4.0.30319.0 的解决方案是什么?

检查 .NET Framework 注册表项

启动注册表编辑器并转到以下两个路径。

路径1:

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

不存在任何子项。

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

路径2:

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

不存在任何子项。

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

检查两个路径,我们发现不存在应该有的子文件夹。

事件 1310 的解决方案,ASP.NET 4.0.30319.0

现在我们收集了信息,让我们应用 .NETFramework v4.0.30319 注册表项及其值。

步骤 1. 下载以下两个注册表文件:

  1. .NET框架v4.0.30319

  2. .NET Framework v4.0.30319 (WOW6432Node)

步骤 2. 双击注册表文件,将它们添加到注册表中。

步骤 3. 验证子项是否存在于以下两个路径中。

路径1:

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

子项存在。

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

路径2:

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

子项存在。

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

对 .NET Framework 2.0.50727 注册表文件执行相同的操作。从下面下载它们:

  1. .NET框架v2.0.50727

  2. .NET Framework v2.0.50727 (WOW6432Node)

注意:我们建议下载.NET Framework v4.x.NET Framework 2.x注册表文件并将它们应用到注册表。这将使它们保持相同。

现在应用了注册表项和值,它修复了事件 1310、ASP.NET 4.0.30319.0。但我们还没有完成。最好启用 TLS 1.2 并禁用旧版 TLS 协议。

设置 TLS 设置

运行 Set-ExchangeTLS.ps1 PowerShell 脚本来设置 Exchange Server 的最佳实践 TLS 设置:

  1. 启用 TLS 1.2

  2. 为 .NET 4.x 启用 TLS 1.2

  3. 为 .NET 3.5 启用 TLS 1.2

  4. 禁用 TLS 1.0

  5. 禁用 TLS 1.1

  6. 禁用 TLS 1.3

如果您想在 Windows 服务器上设置不同的 TLS 设置,您可以调整脚本。例如,您可能想要在 Windows Server 上启用 TLS 1.3,并且您没有运行 Exchange Server,但会出现此错误。

注意:应用 TLS 配置后,您必须重新启动 Windows Server 才能使更改生效。

请阅读配置 Exchange Server TLS 设置一文来了解更多信息。

获取 TLS 设置

检查 TLS 设置的一个很好的方法是运行 Exchange 运行状况检查器脚本。

转到 TLS 部分并验证一切看起来都正常。

[玩转系统] 如何修复事件 1310、ASP.NET 4.0.30319.0 警告

假设您没有 Exchange Server;使用 Get-TLS.ps1 PowerShell 脚本检查 Windows Server 上的 TLS 设置。

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-RegValue $regKey 'Enabled'
$regSettings += Get-RegValue $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

这就是我们的示例中运行 Get-TLS.ps1 PowerShell 脚本后 PS 输出的样子。

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

验证事件 ID 1310 警告不会出现

启动事件查看器 > Windows 日志 > 应用程序。过滤警告和事件 ID 1310。验证该事件 ID 不再发生。

结论

您了解了如何修复事件 1310、ASP.NET 4.0.30319.0。首先,将 .NET Framework 注册表项添加到注册表中。之后,配置 TLS 设置。最后,重新启动 Windows Server。这可能发生在任何 Windows 服务器上。在本例中,它位于 Exchange Server 上。

您喜欢这篇文章吗?您可能还喜欢创建 TLS 客户端凭据时发生致命错误。不要忘记关注我们并分享这篇文章。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯