Do you have a reverse biased diode connected across the solenoid coil?
The need for one is all explained in this pinned topic in the general electronics section:
Flyback diodes and why you need them
Do you have a reverse biased diode connected across the solenoid coil?
The need for one is all explained in this pinned topic in the general electronics section:
Flyback diodes and why you need them