Fill the washer with water, add a full bottle (l liter, 1 quart) of white vinegar and run thru a cycle.
Foxum41 had a good idea with the vinegar. I was thinking baking soda. Again, with no clothes as Foxum41 had said.
Another thought I just had was you need to make sure the smell is from the machine and not from the drain the machine uses. Take the exhaust hose off the drain pipe and give the pipe a sniff. It could be you have odors in the pipe and they are coming up into the machine. I don't know what you would do in that case. I'm not sure baking soda or vinegar would help in that situation. You might need to talk to a plumber.
Two thoughts. Both ideas are run with no clothes in the machine. What I use is Tide washing machine cleaner available in the soap isle of your grocery store. Also try some vinegar. Maybe some other posters have more ideas.
Add your voice to the conversation. Click here to answer this question.