.NET Framework 4.5.1 Broke .NET 4.0 Application


Recently we installed the latest Windows Updates; one of the updates installed .NET Framework 4.5.1!

After installing the updates, .NET 4.0 Web API project stopped working. Following three errors were reported in the logs generated by the application; this is the same code that was running fine before the updates were installed! Please note that each of the following was a separately reported exception which occurred when the code was trying to open a connection to the database.

  • System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  • System.InvalidOperationException: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
  • System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The message received was unexpected or badly formatted.) —> System.ComponentModel.Win32Exception (0x80004005): The message received was unexpected or badly formatted

The following errors were found in the Applications event log.

Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: System.Data.dll, version: 4.0.30319.18408, time stamp: 0x52310bef
Exception code: 0xc0000005
Fault offset: 0x000000000002ca0c
Faulting process id: 0x1c44
Faulting application start time: 0x01cf160933711ff2
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
Report Id: b43e16a4-81fd-11e3-9401-d4ae5267f94a

Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: w3wp.exe
P2: 7.5.7601.17514
P3: 4ce7afa2
P4: System.Data.dll
P5: 4.0.30319.18408
P6: 52310bef
P7: c0000005
P8: 000000000002ca0c
P9:
P10:

Attached files:

These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_w3wp.exe_1dabd81cc049f8988c7cfa9798cf58f89514c50_0970896a

Analysis symbol:
Rechecking for solution: 0
Report Id: b43e16a4-81fd-11e3-9401-d4ae5267f94a
Report Status: 4

Research on Google didn’t help much because different people received these errors in different contexts and the solutions/tips varied from restarting the computer to changing the way we access the database! We didn’t want to touch the code because this application was working moments ago! There has to be something in the Windows Updates that broke the application.

Painstaking review of the Windows Updates which were installed that day couldn’t result in anything important that would help narrow down to a particular update.

image

Then all of a sudden, the light bulb moment! I remember seeing .NET Framework 4.5.1 in the list of updates Windows wanted to install but it wasn’t in the above list! So where did it go? It was found in the “Add/Remove Programs” area. Before we could uninstall it, we wanted to check whether that is the culprit. Little research on .NET Framework 4.5.1 lead us to the KB2915689 which talks about one of the errors we were getting!

image

We tried the first workaround by disabling the Sophos Antivirus which had several BSP/LSP installed on the server but no use; the application still threw the same errors.

The second workaround was to uninstall .NET Framework 4.5.1 and we did just that! Please make a note of the following gotchas (originally listed here) before you install or uninstall .NET Framework 4.5.1

  • The .NET Framework 4.5.1 is an in-place update to the .NET Framework 4.5.
  • The .NET Framework 4.5 and .NET Framework 4.5.1 replace the .NET Framework 4. When you install these versions on a system that has the .NET Framework 4 installed, the assemblies are replaced.
  • Uninstalling the .NET Framework 4.5 also removes pre-existing .NET Framework 4 files. If you want to go back to the .NET Framework 4, you must reinstall it and any updates to it. (See Installing the .NET Framework 4.)

In a nutshell, we were able to run the application again by following these steps:

  1. Uninstall the .NET Framework 4.5.1
  2. Install the .NET Framework 4.0
  3. Update the Application Pool for the particular application to use .NET 4.0 (apparently uninstalling 4.5.1 changed it to .NET 2.0)

Which .NET Frameworks and Updates are Installed?


Recently we had to deal with an issue where a .NET Framework update caused a .NET 4.0 application to stop working. In fact the IIS worker process was crashing! Long story short, we had to figure out which versions of .NET and the respective updates were installed on the server in order to take corrective actions. The following links helped determine the information needed.

How to: Determine Which .NET Framework Versions Are Installed

How to: Determine Which .NET Framework Updates Are Installed

Fix for “The Windows Azure computer emulator must be run elevated” error


Debugging a Cloud Service project in Visual Studio 2013 requires you to run VS under elevated account (such as an Admin). You would receive the following message if you try to Debug the project without running the VS under an elevated account.

image

This happens because by default the Full Emulator is supposed to run which needs the elevated access.

image

You can avoid running the VS under elevated account if you change the Cloud Service project’s Emulator setting to “Use Emulator Express” which does not require the VS to run under elevated account. See below.

image

You would miss out on few features but this may not be a deal breaker for many developers. See the following article for more information – Debugging a Cloud Service with Emulator Express