They are both essentially the same weapon -differ from conventional weapons in that they use electromagnetism to propel the projectile rather than using an explosive charge. Both of them need incredible amounts of energy, which is why they are not practical in an infantry weapon at the moment. The gun barrel and mechanisms do not need to be massively heavy, the problem is supplying the power.
The advantages of rail guns is that they are much simpler to build and operate than a coil gun. They are also more powerful as they have a direct contact between the projectile and the rails while the coil gun has a gap between them.
The advantage of a coil gun though is that the coils can be insulated from the outside world more easily, which could well make them more reliable in the long run. It will be harder for external conditions to interfere with the coils and the coils will take less wear and tear in use. Rail gun rails in particular are subject to a lot of wear even from normal use.