 He served as an officer under Zhangxun Chengye (長孫承業) the Duke of Fengyi and contributed to the army's success, and he was given a post as a teacher at the national university in Luoyang, and then an acting commandery governor.He later served under the prominent official Yang Kan (楊侃), guarding the Tong Pass, when Yang, impressed by him, gave a daughter to him in marriage.Wei became a general during the reign of Emperor Xiaozhuang (528-530) and was created the Baron of Shanbei.