When guards are hitting you, 80% of the time it means you are too close to the door or the front lines. If archer guards hit you, you are too far from the wall. 95% of the time guards that hit me usually get smothered by my allies in seconds.
If guards do get to you, keep moving. Guards have a tendency to be fickle minded and change targets quickly.