Essentially, in a coilgun, the coil draws the projectile towards the center of the coil. The trick is to cut off the power right before the projectile reaches the critical point near the center of the coil where it starts slowing. You're essentially turning on a big ol' electromagnet and turning it off at juuust the right time so that the metal slug you're throwing doesn't stick to it.
In a railgun, however, the projectile is actually bridging the circuit along the rails (or, rather, the armature connected to the projectile is), and thanks to the funkiness of parallel rotating magnetic fields (that are rotating counter to each other), the projectile gets pushed.
The upside of a coilgun is that nothing has to actually touch the coil. The projectile passes through the middle, and you get no more wear and tear on the fragile conductors than you'd get in generator (i.e. we can make them last 50+ years). The downside is that your power->force ratios suck, because you're using less than half the possible magnetic force that you can generate (because the coil has to turn off before the projectile is halfway through the coil).
The upside of a rail gun is that you can use 100% of your magnetic force, all the way down the end of the rail (and it turns off by default once the projectile is out, because the armature is no longer conducting between the rails). This isn't to say that 1 kJ of electricity turns into 1 kJ of force, but you actually get to use much more of the potential magnetic force. The downside? Bridging the circuit like that isn't exactly friendly to the metal, you'll evaporate some of your rail material with each shot. It's worse if you're aren't using a plasma armature (basically you use a really thin piece of aluminum which vaporizes into plasma), as then you have more drag from the armature which you have to overcome, in addition to the actual dragging of the armature along the rail. Oh yeah, and your rails really, really, hate each other and want to move away, but only when your projectile is screaming down them at high speed. So if you don't have those rails really solidly mounted, bending them into uselessness.
Long story short: coilguns will require significantly less maintenance, at the cost of performance.
edit: rails don't attract, they repulse