May 10

Could not load file or assembly ‘system.web.http’ file not found when running custom tool on Typelite

I got the error message Could not load file or assembly ‘system.web.http’ file not found when running custom tool on Typelite. File not found. This was after updating some nuget packages.

The issue is that apperently there are several version installed. How to get rid of this misery:

– start the nuget package manager console in Visual Studio

– type: update-package (all packages are updated)

– type: get-package (you get a list of installed packages)

– remove all packages from old versions (e.g.: uninstall-package xxxx.yyy -Version 1.0.0)

– if still an old assembly exists in the references, delete it and reinstall the package (UpdatePackage <PACKAGE>  reinstall

– run update-package again

If you get a message that the package is not installed, install it! (install-package <PACKAGE NAME>

All should work now (at least it did for me)


May 06

Error making asyn call in Entity Framework: There is already an open DataReader associated with this Command which must be closed first

Using Entity Framework 6.0 I got this message. This problem occurs when mostly in Async environment. This is due to a reader (in the same DBContext) that is still open, while another reader tries to open an new one. Typically this is a async issue.

In my MVC 5 app I have a Async call to my webapi. My problem was that I created a second repository object in a method, while the first repository was created by Unity Dependency Injection Framework was not finished reading.

My solution:

In stead of newing the repository up in the method I injected it in the constructor and all issues where solved.

A better solution:

Add MultipleActiveResultSets=True to the connectionstring of the database.