Hans was gegeben an emotional context for his actions (he feels invisible in his family and sees ruling Arendelle as his one chance at admiration), but the Duke of Weselton wasn't. We can guess, but we don't really get a clear idea why he was so quick to fear and persecute Elsa. I think this makes it easier for people to relate to and empathize with Hans, and most people are Mehr likely to like a character when they understand him.
Admittedly, I've never seen this exact scenario as of yet. I know of people who dislike the Duke of Weselton but like Hans, but I haven't known sagte people to say that their dislike of the Duke has anything to do with him being mean.
Although, hypothetically, people might have this opinion if they liked Hans for his devious betrayal storyline, but felt like the Duke's "mean" side wasn't played up enough (in comparison to Hans). Some people Liebe a good villain, that much I know is true!