Driving a 12V-24V 20 ohm solenoid from a 24V 0.5A input signal
Check the maths: V = 24 V, R = 20 Ω. If you hook the two together you get \$ I = \frac V R  = \frac {24}{20} = 1.2 \ \text A\$ which is too much for your PSU.
If we run it at 12 V we'll get 0.6 A which is still too much for your supply. If you want to chance it then you'll need to add a 20 Ω resistor in series. The power rating of this resistor will be given by \$ P = I^2R = 0.6^2 \times 20 = 7.2 \ \text W \$. You're going to need a 10 W wirewound resistor mounted on a suitable heatsink.
As a quick hack you could try wiring a 6 W, 12 V tail-lamp in series with the solenoid. Measure the current and monitor the PSU temperature for a while to satisfy yourself that you're not going to start a fire.