The 38-year-old, seen in TV shows such as "How I Met Your Mother", says that a man named John Hobbs, who is mentally unstable, is threatening to kill her through posts on Facebook, MySpace and her website, reports tmz.com.
Hannigan also claims that Hobbs threatened to rape her by writing online: "Lets see How can I get myself in trouble today. If I go with what I've been accused of most of my life, I suppose I should start with being a rapist, so any nice girls out there want to get raped."
The actress has demanded protection for husband Alexis Denis and daughters Satyana, three and nine-month-old Keeva. A hearing has been set for March 6 when a judge will decide whether to make the restraining order permanent.