Work function of semiconductor should be higher thn metal WF for rectifying contact, the energy of the system can be reduced by holes flowing from the semiconductor to the metal, causing a depletion region.
So, care must be taken for controlled work function to get rectifying behaviour.