Candidates in a by-election for a seat in a conservative heartland have made their final pitches as they cast their votes.