Controversial plans for a solar farm in the County Durham countryside have been refused.