Support Thread

Keynotfoundexception Production Site Is Down

📅 👤 ASP Playground
Keynotfoundexception Production Site Is Down — APG vNext Guide

This archived support thread addresses Keynotfoundexception Production Site Is Down. The discussion below documents the reported issue and the steps taken to resolve it.

Troubleshooting Steps

When encountering errors in APG vNext, the following steps help diagnose the problem quickly:

  • Enable detailed errors: Set customErrors mode="Off" in web.config to see the full error message and stack trace.
  • Check the Windows Event Log: Application-level ASP.NET errors are logged in the Windows Event Log under Application.
  • Review the APG error log: Admin Panel → Logs → Error Log shows application-level errors with timestamps.
  • Verify recent changes: If the error appeared after an upgrade or configuration change, roll back or review what changed.

Common Fixes

  • Restart the IIS Application Pool to clear stale state
  • Verify database connectivity and run any pending SQL upgrade scripts
  • Check that all required .NET assemblies are present in the bin folder
  • Clear the ASP.NET temporary files folder (%windir%\Microsoft.NET\Framework\...\Temporary ASP.NET Files)

For further assistance, visit the support forum or review the Knowledge Base.

Resolving KeyNotFoundException in APG vNext

A KeyNotFoundException crash that takes down a production APG vNext forum is a critical incident requiring immediate diagnosis and resolution. This exception type in .NET is thrown when code attempts to retrieve a value from a dictionary, configuration collection, or similar key-value store using a key that does not exist. In APG vNext, this most commonly occurs after an upgrade, a configuration change, or a deployment where configuration files are out of sync with the application code.

Identifying the Source of the Exception

The first step is finding exactly which key is missing and in which dictionary or collection. The full stack trace is essential for this. In a production environment, detailed error messages may be suppressed by the customErrors setting in web.config. Temporarily set customErrors mode to Off to expose the full exception details in the browser, or review the detailed error in the Windows Application Event Log or the IIS Detailed Error Logs. The stack trace will show you the method name where the exception was thrown and the key value that was not found.

Common Causes: AppSettings Configuration Keys

The most common source of KeyNotFoundException in APG vNext is a missing entry in the appSettings section of web.config. When an APG vNext upgrade adds new required configuration keys, the upgrade documentation lists them explicitly. If you upgraded by replacing application files without also updating web.config with the new required keys, any code path that accesses one of those new keys will throw KeyNotFoundException the first time it is executed.

Compare your current web.config against the sample web.config shipped with the new APG version. Add any missing appSettings keys using the default values from the sample configuration. After adding the missing keys, restart the application pool to clear the cached configuration and test the site.

Common Causes: Database-Stored Settings

APG vNext stores many forum settings in the database settings table rather than web.config. These settings are loaded into an in-memory dictionary on application startup. If the settings table is missing a row that the application now expects (which can happen when a database upgrade migration script was only partially executed), any access to that setting key will throw KeyNotFoundException.

To diagnose this, query the APG settings table directly: SELECT * FROM aspx_settings WHERE setting_name LIKE '%keyword%'. Compare the rows present against the list of expected settings from the APG vNext documentation for your version. Insert any missing settings rows with appropriate default values and restart the application.

Common Causes: Theme or Plugin Configuration

If the crash only occurs on certain pages or after enabling a specific feature, the KeyNotFoundException may originate in a theme template or plugin that references a configuration key that does not exist. Disable recently installed or updated plugins one at a time from the admin panel to identify if a plugin is responsible. If the crash is theme-related, switch to the default APG vNext theme temporarily to confirm. If the crash stops after switching themes, the issue is in the custom theme referencing a non-existent variable or configuration key.

Emergency Recovery Steps

If the site is completely down and you cannot access the admin panel, restore from the last known good backup immediately. APG vNext backups should include both the database and the application files. After restoring, the site should return to the pre-crash state. Then apply the missing configuration fix in the restored environment before attempting the upgrade or change again. Always test upgrades and configuration changes in a staging environment that mirrors production before applying them to the live forum.

Preventing Future KeyNotFoundException Crashes

Implement a pre-deployment checklist that includes comparing web.config against the new version's sample configuration, verifying all database migration scripts ran to completion without errors, and running a smoke test on a staging environment before any production deployment. Add the staging environment to your monitoring so that KeyNotFoundException errors caught in staging alert the team before the change reaches production users.


Looking for more help? Browse the support forum or check the Knowledge Base.