.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)
Advertisements

7 thoughts on “.NET Framework 4.5.1 Broke .NET 4.0 Application

  1. We have the exact same problem on our production server. We also had to revert back to .NET 4. However, we need some new feature of .NET 4.5 and eventually we have to go there. Did you find out anything else about this issue? Were you able to upgrade to 4.5?

    • @ Stephen. No, we have not found a solution just yet; awaiting another upgrade of .NET to see if that works as expected. Will update the post if a solution is found.

  2. I think we have an answer for this issue. We host our servers at Rackspace and they are the one who installed Sophos on our server. They just confirm to us that the issue was caused by Sophos 9.7. They are going to upgrade that to version 10.3. I’ll let you know the result.

  3. I ran into the same issue today. I installed 4.5.1 onto my PC and my application began giving me the same error you explained. A co-worker has 4.5.1 installed on his PC (along with several of the Multi-Targeting 4.5.1 installs) and he is having no issues. We also installed this application onto our IIS box where we only have the 4.5.1 framework installed and the application is working with no issues. As for now, I have given up and punted on this issue. I have uninstalled 4.5.1 on my pc and things are back to normal (for now). If I have a chance to put more attention to this and figure out the problem, I will be sure to post it here.

    (btw ….yes, it is “that” Kareem)

  4. @Stephen Thanks for posting the solution. We will try this out during our next server patch cycle. I will post the updates.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s