Wired IK behavior, would someone please help me?

The IK behavior on this model seems very wired. I used a meta-rig in this case. Set the IK constrant for the left leg including a IK target and a IK pole.

However, no matter how i played with the parameters, the IK solver keeps bending the leg to the wrong direction.

Would someone kindly take a look and tell me what is wrong? Thanks in advance.

I don’t know why but the forum keeps telling upload file failed, so i put the file in onedrive.

file is put in:
https://onedrive.live.com/redir?resid=5B59C58F3AB08AE9!157

The bones in the ik chain require an intial rotation, so for this, it would probably be best to rotate the shin bones back a bit in pose mode.
Also check the Properties > Bone > IK panel, there are some options to lock and limit rotation.

I think new users cant attach files till a number of posts, pasteall.org is commonly used webpage.