Let β ≡ β (2n) = {β i } |i| 2n denote a d-dimensional real multisequence, let K denote a closed subset of R d , and let P 2n := {p ∈ R[x 1 , . . . , x d ]: degp 2n}. Corresponding to β, the Riesz functional L ≡ L β : P 2n → R is defined by L( a i x i ) := a i β i . We say that L is K-positive if whenever p ∈ P 2n and p| K 0, then L(p) 0. We prove that β admits a K-representing measure if and only if L β admits a K-positive linear extensionL : P 2n+2 → R. This provides a generalization (from the full moment problem to the truncated moment problem) of the Riesz-Haviland theorem. We also show that a semialgebraic set solves the truncated moment problem in terms of natural "degree-bounded" positivity conditions if and only if each polynomial strictly positive on that set admits a degree-bounded weighted sum-of-squares representation.