Has there been any impacts with the blade? Have you adjusted the valves recently?
Is this the mower you're working on?
Make: MTD Pros SeriesModel: 287707 (off engine)
If you are getting flames from the carb, it should be related either to the wrong air/fuel mixture, valves, or timing.
When you replaced the fuel solenoid, did you flush the gas tank and replace the fuel line?
Why don't you take a look in the carburetor bowl and see if you see any signs of sediment or residue, please. I would also suggest looking for any plugging in the main jet. If you can give me the type and code numbers that are listed after the 287707 on your engine I should be able to get you a diagram showing you exactly where to look.
Thank you. You'll have either a Walbro or Nikki carburetor on there. Here's a link to a breakdown.
The main jet is 117/117A depending on which style you have. Take a look for sediment and plugging in any of the passages, please. A piece of soft wire like a bread tie can be used to clear the passages. Spray carb cleaner is a good idea too. But still probe with the wire.
Let me know and we'll continue...