Home » IIS » Nuget package for System.Net.Http on .NET Framework 4.7.2 and newer versions

Nuget package for System.Net.Http on .NET Framework 4.7.2 and newer versions

If your web application has dependency on the System.Net.Http Nuget package, it may break after you upgrade .NET Framework version to 4.7.2 or a newer version. This issue occurs if you are using Visual Studio 15.5 or a higher version.

The application may throw an error like this:

Initialization failed
Failed to replace the search service. Check the error log for more information.
at Telerik.Sitefinity.Services.Search.SearchModule.RegisterService (SearchConfig config)
at Telerik.Sitefinity.Services.Search.SearchModule.Initialize (ModuleSettings settings)

Initialization failed Telerik Sitefinity

The reason behind is the decision about using the corresponding platform DLLs that come with .NET Framework instead of using Nuget packages.


Using a Visual Studio version that is lower than 15.5 may get the application working again but this is not recommended. Older versions of Visual Studio may present security vulnerabilities to your organization. They are also not supported by Microsoft.

There is another workaround mentioned in this document. It didn’t work in the case I worked on but it may work in other environments.

Here is a related GitHub topic.

Solution System.Net.Http Nuget package related issues

The recommendation is to use System.Net.Http DLL that comes with .NET Framework. You can simply add it as a reference to your Visual Studio solution.

If your application throws errors when you switch Nuget DLL with platform DLL, it means it is not compatible with the new libraries. Coding changes will be required to make it compatible. Even though it may take time and effort to make these changes, this is still the recommended approach as the Nuget package may be deprecated eventually.

If you see BadImageFormatException for System.Net.Http, System.IO.Compression or other libraries when you access your web application, check this post out: How to enable Assembly Binding Logging (Fusion Log Viewer – fuslogvw.exe)?

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

Leave a Comment