For those with same error, as Laura Díaz mentioned in her comment, the problem was she had another call to ConfigureServices allready in the project.
Calling twice or more, it tries to register in .net dependency container the same n times which ends up in that error.