WinCC Flexible 2008 Startup Failure: system.messaging.dll Fix

David Krause9 min read
HMI / SCADASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Overview

Siemens WinCC Flexible 2008 (SP2 / SP3 / SP4 / SP5) fails to complete startup. The splash screen appears and the progress indicator freezes while the runtime attempts to load:

C:\Windows\assembly\GAC_MSIL\System.Messaging\2.0.0.0__b03f5f7f11d50a3a\System.Messaging.dll

The file physically exists in the Global Assembly Cache (GAC), but the WinCC flexible 2008 loader (the Configuration and Runtime components both call into the same CLR host) never advances past the assembly bind. In virtually every documented case the root cause is a corrupted or incompatible instance of Microsoft SQL Server 2005 Express Edition, which WinCC Flexible 2008 ships with and depends on for its project archive, alarm logging, recipe database, and user administration stores.

The condition is reproducible after:

  • An improper shutdown of the configuration tool (kill of HMIRTm.exe or CCLoadServer.exe during a write).
  • Manual uninstallation of SQL Server 2005 components without running the WinCC Flexible maintenance routine first.
  • Applying Windows security updates that replace mscorwks.dll / clr.dll in a way the embedded SQL broker does not accept.
  • Re-imaging or restoring a system image whose SQLEXPRESS instance master database is stale.
  • Side-by-side installation of a newer SQL Express (2008 / 2012 / 2014) that hijacks the SQLEXPRESS named instance expected by WinCC Flexible 2008.
Field fact: The visible filename System.Messaging.dll is a symptom, not the cause. WinCC Flexible 2008 binds it transitively through System.Data.dllSystem.Transactions.dllSystem.Messaging.dll while initializing the SQL Express connection. A native hang on System.Messaging almost always means the SQL handshake failed and the .NET loader is deadlocked on a missing/inaccessible MSDTC / SQL service dependency.

Root Cause: Why System.Messaging.dll Hangs

The .NET Framework 2.0 GAC bind for System.Messaging (strong name 2.0.0.0__b03f5f7f11d50a3a) succeeds — that is why no Fusion Log error appears — but the managed caller inside WinCC Flexible's archive engine spins on a SqlConnection.Open() call routed through System.Messaging message-queueing code paths. When the local SQL instance SQLEXPRESS is broken:

  1. WinCC Flexible attempts to open the database WinCCFlexible on (local)\SQLEXPRESS.
  2. The TDS handshake fails (master database corrupt, login broken, or service not running).
  3. The internal .NET managed deadlock detector waits up to 90 s before yielding the loader thread.
  4. The splash screen remains frozen because the main UI thread is waiting on the same threadpool token.

This explains why reinstalling WinCC Flexible alone without removing the broken SQL instance does not fix the issue — the installer reuses the existing instance.

Affected Versions and Editions

Component Version Status
WinCC Flexible 2008 2008 (base) Affected
WinCC Flexible 2008 SP1 8.1.x Affected
WinCC Flexible 2008 SP2 8.2.x Affected (most reported)
WinCC Flexible 2008 SP3 8.3.x Affected
WinCC Flexible 2008 SP4 8.4.x Affected
WinCC Flexible 2008 SP5 8.5.x Affected (last 2008 release)
SQL Server 2005 Express SP4 9.00.5000 Affected when corrupted
SQL Server 2005 Express SP3 9.00.4035 Affected when corrupted
SQL Server 2008 R2 Express 10.50.x Not shipped; side-install conflicts possible
Windows XP Professional SP3 5.1.2600 Supported host
Windows 7 Professional / Ultimate 6.1.7601 Supported host
Windows Server 2003 R2 5.2.3790 Supported host
Windows Server 2008 R2 6.1.7601 Supported host

Prerequisites for Recovery

Before executing the fix, gather the following:

  • Original WinCC Flexible 2008 installation media or a verified DVD image (the install set must include the bundled SQL Server 2005 Express).
  • Local administrator credentials for the engineering station.
  • Project backups (.hmi, .fwd, .ldf archive of C:\Program Files\Siemens\Automation\WinCC Flexible\).
  • License keys / license diskettes (these are tied to the host SID and may need reactivation after SQL reinstall on a domain controller).
  • If multiple HMI runtime projects share the same SQL Express instance, schedule a maintenance window for all connected panels.
Pre-check: Capture the current state with sc query MSSQL$SQLEXPRESS and reg query "HKLM\Software\Microsoft\Microsoft SQL Server\SQLEXPRESS" /s. Save the output to C:\backup\pre-uninstall.txt. This lets you reverse the operation if a customer-mandated rollback is required.

Step-by-Step Recovery Procedure

Step 1 — Stop All WinCC Flexible Processes

  1. Open Task ManagerDetails.
  2. End the following processes if present:
    CCLoadServer.exe
    HMIRTm.exe
    HmiEs.exe
    ProAgent.exe
    WinCC flexible 2008.exe
  3. Set the SQL service to disabled:
    sc config MSSQL$SQLEXPRESS start= disabled
    sc stop MSSQL$SQLEXPRESS

Step 2 — Uninstall Microsoft SQL Server 2005 Express

Use Add or Remove Programs (XP) / Programs and Features (Win7/Server 2008 R2) and remove in this strict order:

  1. Microsoft SQL Server 2005
  2. Microsoft SQL Server 2005 Tools
  3. Microsoft SQL Server 2005 Backward compatibility
  4. Microsoft SQL Server Native Client
  5. Microsoft SQL Server Setup Support Files
  6. Microsoft SQL Server VSS Writer

If the uninstaller returns error 0x84BB0001 or hangs, run the cleanup tool:

setup.exe /ACTION=uninstall /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /QUIET

Step 3 — Remove Orphan SQL Registries and Data Directories

After uninstall, delete the following if they still exist:

  • C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\
  • C:\Program Files (x86)\Microsoft SQL Server\ (on x64 hosts)
  • HKLM\Software\Microsoft\Microsoft SQL Server
  • HKLM\Software\Microsoft\MSSQLServer
  • HKLM\Software\Wow6432Node\Microsoft\Microsoft SQL Server (x64)
  • HKLM\SYSTEM\CurrentControlSet\Services\MSSQL$SQLEXPRESS
  • HKLM\SYSTEM\CurrentControlSet\Services\SQLAgent$SQLEXPRESS
  • HKCR\CLSID\{...}\Microsoft SQL Server Data Link orphans

Reboot the engineering station before continuing.

Step 4 — Uninstall WinCC Flexible 2008

From Programs and Features, select SIMATIC WinCC flexible 2008 and choose Uninstall. Accept the removal of the SQL dependency check. If the installer warns about residual data directories, allow it to clean them.

Step 5 — Reinstall WinCC Flexible 2008

  1. Insert the original WinCC Flexible 2008 DVD (or mount the ISO).
  2. Launch Setup.exe as administrator.
  3. Choose InstallWinCC flexible 2008.
  4. The installer detects that SQL Server 2005 Express is missing and prompts for setup. Confirm.
  5. Choose the default instance name SQLEXPRESS. Do not rename it — WinCC Flexible hard-codes (local)\SQLEXPRESS in the registry keys HKLM\Software\Siemens\Automation\WinCC flexible\2008\Database.
  6. When asked for authentication mode, select Windows Authentication (the default). Mixed mode is supported but rarely needed.
  7. Complete the installation.

Step 6 — Activate License and Restore Project

  1. Start Automation License Manager → transfer the license to the local license container.
  2. Launch WinCC flexible 2008. The splash screen should now pass System.Messaging.dll in < 2 seconds.
  3. Open File → Restore and select the latest .hmi backup. Alternatively, recompile from the original TIA / Flex source.

Verification

After the recovery, perform the following checks before returning the station to production:

Check Command / Action Expected Result
SQL service running sc query MSSQL$SQLEXPRESS STATE: 4 RUNNING
Database exists sqlcmd -S (local)\SQLEXPRESS -E -Q "SELECT name FROM sys.databases WHERE name LIKE 'WinCC%'" Returns WinCCFlexible and master
Login works Login as the WinCC Flexible user, start the application No System.Messaging.dll hang
Archive engine Open project → Tools → Archive Archive list populated, no ODBC error
Runtime compile Project → Compiler → Generate Runtime Compiles without SQLDMO or msado15.dll errors
Transfer to panel Transfer dialog → Ethernet / MPI / PROFIBUS Transfer succeeds; panel reboots into Runtime
Event log eventvwr.msc → Application log No error 2601, 17204, or 17207 from MSSQL$SQLEXPRESS

Alternative Recovery Paths

In-Place Repair Without Full Uninstall

If a full uninstall is unacceptable (e.g., license activation server is offline), attempt a repair first:

  1. Reinsert the WinCC Flexible 2008 DVD.
  2. Run Setup.exe /repair and select Repair.
  3. If the SQL Express instance is still unhealthy, the repair will fail at the database integrity step. Proceed to the full uninstall described above.

Repair Just the SQL Instance

  1. Stop MSSQL$SQLEXPRESS.
  2. From the SQL 2005 Express install media, run setup.exe with:
    start /wait setup.exe /qb REINSTALL=SQL_Engine REINSTALLMODE=OMUS
  3. Reboot. Verify with sqlcmd -S (local)\SQLEXPRESS -E -Q "SELECT @@VERSION". Expected: Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86) or higher SP.

Rebuild the Master Database

Only if setup.exe /repair fails with error 29506 or 29528:

  1. setup.exe /ACTION=rebuilddatabase /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS=BUILTIN\Administrators /QUIET
  2. Restore master, msdb, and WinCCFlexible from the last known-good backup.

Reference: WinCC Flexible 2008 SQL Dependency Map

WinCC Flexible 2008 Feature Database / Object SQL Service Required
Project archive WinCCFlexible database, table ARCHIVE MSSQL$SQLEXPRESS
Alarm logging WinCCFlexible, tables ALARM_* MSSQL$SQLEXPRESS
Tag logging WinCCFlexible, tables TAG_* MSSQL$SQLEXPRESS
Recipes File system + DB sync table MSSQL$SQLEXPRESS (optional)
User administration WinCCFlexible, table USERS MSSQL$SQLEXPRESS
Audit Trail (ProAgent) WinCCFlexible, table AUDIT MSSQL$SQLEXPRESS

Troubleshooting Matrix

Symptom Likely Cause Action
Splash freezes on System.Messaging.dll SQL Express broken Full uninstall procedure above
Error 2147217865 at startup Invalid SQL login Re-add the WinCC service account to SQL logins
Error 4060 in Application log Cannot open database WinCCFlexible Detach/attach, then rebuild master if needed
Error 0x84BB0001 during uninstall MSI database lock Kill msiexec.exe, rename %TEMP%\*.tmp, retry
Runtime starts but transfer fails Mixed SQL instance name Reinstall to restore SQLEXPRESS instance name
Splash appears but immediate crash CLR mismatch (.NET 4.0 promoted) Set HKLM\Software\Microsoft\.NETFramework\Policy\v2.0 to legacy
Slow load (90+ seconds) DNS resolver delay on (local) Add 127.0.0.1 mapping in hosts
Archive dialog empty SQL Agent stopped Set SQLAgent$SQLEXPRESS to Automatic and start

Side-by-Side SQL Interference

WinCC Flexible 2008 is hard-bound to a SQL 2005 Express instance named SQLEXPRESS. Installing any of the following after WinCC Flexible can corrupt the binding and reproduce the System.Messaging.dll hang on next start:

  • SQL Server 2008 / 2012 / 2014 Express with default instance SQLEXPRESS (collision).
  • Visual Studio 2010+ with LocalDB (replaces SQLEXPRESS token).
  • Microsoft Office Access with SQL Native Client 11.
  • Antivirus quarantine of sqlservr.exe after signature update.

To detect collisions, run:

reg query "HKLM\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL"

If more than one instance named SQLEXPRESS is present, stop and uninstall the foreign one, then perform the WinCC Flexible recovery procedure.

Preventive Maintenance Checklist

  1. Schedule a weekly DBCC CHECKDB ('WinCCFlexible') through SQLCMD.
  2. Exclude C:\Program Files\Microsoft SQL Server\ from real-time AV scans (add to exclusion list with a documented process; document the deviation in the cybersecurity plan).
  3. Disable Windows Search Indexer on the SQL data and log folders.
  4. Image the engineering station every quarter; verify the image includes a healthy SQLEXPRESS master database.
  5. Never kill WinCC Flexible processes via Task Manager — always close from the File menu or send WM_CLOSE to WinCC flexible 2008.exe.
  6. Apply WinCC Flexible updates only after confirming compatibility on a non-production engineering station.

Migration to TIA Portal WinCC (Long-Term Path)

WinCC Flexible 2008 reached end of life on 30 September 2020. New installations should consider migrating to TIA Portal WinCC (Comfort / Advanced / Professional panels). Migration utility: WinCC flexible → TIA Portal migration tool. Note that project variables, screens, and alarms migrate automatically; recipes and VB scripts require manual review.

FAQ

Why does WinCC Flexible 2008 hang on System.Messaging.dll when the file is present?

The GAC bind succeeds, but the .NET loader is waiting on a SQL Server 2005 Express connection that never returns. The visible filename is a symptom of a SQL handshake deadlock, not a missing assembly.

Do I really need to uninstall SQL Server 2005 Express separately?

Yes. WinCC Flexible's own uninstaller does not remove the SQL instance, so reinstalling the application reuses the broken instance and the hang returns. Remove SQL 2005 Express first, then WinCC Flexible, then install WinCC Flexible so its bundled SQL setup runs against a clean host.

Can I install SQL Server 2008 R2 Express instead of the bundled 2005?

Not without breaking the (local)\SQLEXPRESS binding. WinCC Flexible 2008 uses SQL-DMO and the SQL 2005 Native Client. If you must upgrade, do so only after migrating to TIA Portal WinCC or WinCC V7.

What Windows event IDs confirm the SQL corruption?

Look for MSSQL$SQLEXPRESS sources emitting event IDs 17204 (cannot open MDF), 17207 (cannot open file), 9001 (log unavailable), 3414 (recovery failure), and .NET Runtime event 1023 indicating an unhandled exception during binding.

Is there an in-place fix that avoids license reactivation?

Run setup.exe /ACTION=uninstall /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /QUIET to remove only the SQL instance, then launch the WinCC Flexible installer and choose Repair. If the repair finishes, the license container remains intact.

Does this problem also affect WinCC Flexible 2007 or 2005?

Yes, the same SQL 2005 Express dependency exists in WinCC Flexible 2005 and 2007. The fix procedure is identical: remove the SQL instance, reinstall the HMI software so it recreates the database.

Back to blog