Some tactics I learned in 20+ years of running daily, encountering hundreds of barking dogs, but only having been bitten once. I have had several dogs and love 'em, but you have to know about them.
First of all, as has been suggested, shouting “NO” very often helps and the dog will retreat. However, watch them closely, because in the rare cases when they may be coming toward you still-legged, no wagging tale, snarling, and possibly hair standing, you are in trouble with a vicious dog. 1. Do not look them in the eye. 2. Stop running. 3. try to slowly walk across the street (often off their perceived territory). If all that fails:
Passing places where I knew a dog would come rushing out, I’d always pick up a few small stones (or make snowballs in winter). Just threatening to throw these often makes the dog stop. If not, plinking it on the head usually worked.
You probably carry a water bottle, so just squirting water at the dog, as somebody suggested, very often works great (most bicyclists do this). If you have problems with a dog that consistently comes at you every time you go by, have another water bottle with a mixture of water and ammonia and a squirt of that will almost assure control. However, better paint that bottle red or something so you don’t take a drink from it. 
I tried a couple of different pepper or mace type spray cans, but found that they didn’t spray far enough, especially on a windy day.
One route I used to run had a very aggressive dog, and following all the above rules did not work. He’d come right across the street at me, but when I stopped, yelled, and walked slowly, he never bit me. However, I got sick of this, so started carrying a sawed-off broom handle (not a sawed-off shotgun), and threatening him with that for a few days really worked, and he never crossed the street again.
The one time I got bitten (right on the butt) was by a maverick Saint Bernard that had been terrorizing the neighborhood. He was hiding behind a bush, ran out and got me before I even knew he was there. I stopped as did he, and he came at me again so I got in a really good kick right under his jaw and he ran away.
My ass was bleeding badly, so held a towel to it and went to the animal’s owner. The woman (who had to be pretty stupid to leave this dog out all the time) told me I must have been doing something to aggravate it! Yeah, breathing. As she was so miserable (the paper boy and postman had complained about the dog several times), I called the Dog Control office and they made them keep it inside for two weeks to be sure it (or I) did not have rabies. My doc sewed my but up.
After the two-week period, the damned dog was out again, so I reverted to the broom handle, which he respected. I was so angry about this, I called a lawyer friend. He went to talk to them, threatened a big lawsuit (I was training for a marathon), and settled for $600 and he took no fee. I began think, hell, I’ll be glad to get bitten anytime for $600. You may want to consider that. 
The lawyer also called her insurance company which threatened to raise her premiums if it happened again. Never saw the dog outside again.