Once heated, try removing the solenoid using a proper wrench or socket with steady torque — not impact.
If it’s still stuck, tap lightly on the wrench to help break the bond.
A penetrating oil (like PB Blaster or Kroil) can help once things are warm and expanding.