Did it run out of fuel before this problem started? If this happened I would bleed air out of the fuel system. There is a primer pump in the engine compartment under the passenger seat.
There could be other reasons for this problem. When the key is turned for the engine to run power is given to the solenoid to allow fuel. With the key off the solenoid snaps shut and the engine stops.
The power to this solenoid could have a faulty connection or the engine ECU could be damaged.