Troubleshooting SMTP Server Crashes on Windows Server 2022 (IIS 6.0 Manager Configuration Issues)


9 views

After setting up a fresh Windows Server 2022 Standard (21H2) installation, I encountered persistent SMTP service crashes when attempting to send emails internally through IIS 6.0 Manager. The service would either fail to start properly or crash immediately during message transmission.

The primary error manifests in two ways:

1. Accessing SMTP Virtual Server properties generates:
   "The system cannot find the file specified" (Error 0x80070002)
   
2. When sending messages, Event Log shows:
   "The SMTP service terminated unexpectedly" (Event ID 7031)

Before diving deep, let's verify these fundamental settings:

# PowerShell check for SMTP feature status
Get-WindowsFeature SMTP-Server | Select-Object Installed

# Check service status
Get-Service SMTPSVC | Select-Object Status,StartType

# Verify IIS 6.0 compatibility components
Get-WindowsFeature Web-Lgcy-Mgmt-Console | Select-Object Installed

After extensive testing, I discovered this is primarily caused by:

  • Missing registry permissions for the SMTP service account
  • Incomplete installation of legacy IIS 6.0 components
  • Conflicts with Windows Defender Application Control (WDAC)

Here's the complete fix that worked:

1. Repair IIS 6.0 Management Compatibility

# Install required legacy components
Install-WindowsFeature Web-Lgcy-Mgmt-Console -IncludeManagementTools

# Reinstall SMTP Server
Uninstall-WindowsFeature SMTP-Server
Install-WindowsFeature SMTP-Server -IncludeManagementTools

2. Fix Registry Permissions

# PowerShell script to reset permissions
$acl = Get-Acl "HKLM:\SYSTEM\CurrentControlSet\Services\SMTPSVC"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule(
    "NT SERVICE\SMTPSVC",
    "FullControl",
    "ContainerInherit,ObjectInherit",
    "None",
    "Allow"
)
$acl.AddAccessRule($rule)
Set-Acl -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SMTPSVC" -AclObject $acl

3. Configure SMTP Properly

After applying these fixes, reconfigure SMTP with these critical settings:

# Sample configuration for internal relay
$config = @{
    "Bindings" = "127.0.0.1:25"
    "SmartHost" = ""
    "RelayRestrictions" = "127.0.0.1"
    "Authentication" = "Anonymous"
}

Verify functionality with this PowerShell test script:

$mailParams = @{
    From = "test@yourdomain.com"
    To = "recipient@yourdomain.com"
    Subject = "SMTP Test"
    Body = "If you receive this, SMTP is working!"
    SmtpServer = "localhost"
    Port = 25
}

try {
    Send-MailMessage @mailParams -ErrorAction Stop
    Write-Output "SMTP test succeeded"
} catch {
    Write-Output "SMTP test failed: $_"
    Get-EventLog -LogName Application -Source "SMTPSVC" -Newest 5 | 
        Format-List -Property *
}

For enterprise environments, consider these enhancements:

  • Implement TLS encryption for internal SMTP
  • Configure proper logging in %SystemRoot%\System32\LogFiles\SMTPSVC1
  • Set up performance monitoring counters

Recently configured a fresh Windows Server 2022 Standard (21H2) installation, only to encounter persistent SMTP Virtual Server crashes when attempting internal email delivery. The IIS 6.0 Manager shows intermittent access issues, and every SMTP send operation triggers service termination with cryptic Event Log entries.

The critical error typically appears as Event ID 115 with source "SMTPSVC":

Event ID: 115
Source: SMTPSVC
Description: The server could not bind to the transport. 
The data is the error code.

Start with these fundamental verifications:

  1. Confirm SMTP Server feature is properly installed via Server Manager
  2. Validate IIS 6.0 compatibility components are enabled
  3. Check binding configuration in IIS 6.0 Manager

Try this PowerShell script to reset port bindings:


# Reset SMTP bindings
Import-Module ServerManager
$smtp = Get-WindowsFeature SMTP-Server
if ($smtp.Installed -eq $false) {
    Add-WindowsFeature SMTP-Server
}

# Release and rebind port
Stop-Service SMTPSVC
netsh http delete iplisten ipaddress=0.0.0.0
netsh http add iplisten ipaddress=0.0.0.0
Start-Service SMTPSVC

Create this registry key if missing:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SMTPSVC\Parameters]
"BindToAllAdapters"=dword:00000001

Use this VBScript to test basic SMTP operations:


Set objEmail = CreateObject("CDO.Message")
objEmail.From = "admin@domain.local"
objEmail.To = "test@domain.local"
objEmail.Subject = "SMTP Test"
objEmail.TextBody = "This is a test message"

objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update

On Error Resume Next
objEmail.Send
If Err.Number <> 0 Then
    WScript.Echo "Error: " & Err.Description
Else
    WScript.Echo "Message sent"
End If

Enable SMTP protocol logging in IIS 6.0 Manager:

  1. Right-click SMTP Virtual Server
  2. Select Properties → General tab
  3. Enable logging with "W3C Extended Log File Format"
  4. Configure daily logs with maximum properties

After applying fixes, verify these components:

  • SMTP service dependency on IIS Admin Service
  • TCP/IP port 25 availability (netstat -ano)
  • Windows Firewall exceptions for SMTP
  • DNS resolution for local domain