I use the vinegar and soap combo successfully. You need to leave it out for several days in order to get all the young ones as well. Clean your trash cans (found a breeding ground under the lip of the can once). Place vinegar mixture near drains.
For prevention, we keep bananas in a banana bag, made by me natch, out in the garage's pantry. Banana peels are thrown out in the garage's trash can. We never get flies from anything other than bananas.