  We discuss a method to solve models with long-range interactions in the
microcanonical and canonical ensemble. The method closely follows the one
introduced by Ellis, Physica D 133, 106 (1999), which uses large deviation
techniques. We show how it can be adapted to obtain the solution of a large
class of simple models, which can show ensemble inequivalence. The model
Hamiltonian can have both discrete (Ising, Potts) and continuous (HMF, Free
Electron Laser) state variables. This latter extension gives access to the
comparison with dynamics and to the study of non-equilibri um effects. We treat
both infinite range and slowly decreasing interactions and, in particular, we
present the solution of the alpha-Ising model in one-dimension with
$0\leq\alpha<1$.
