A method of constructing a canonical gauge-invariant quantum formulati
on for a non-gauge classical theory depending on a set of parameters i
s advanced and then applied to the theory of a closed bosonic string i
nteracting with massive background fields. Choosing an ordering prescr
iption and developing a suitable regularization technique, we calculat
e quantum gauge algebra up to linear order in background fields. The r
equirement of closure for the algebra leads to equations of motion for
the massive background fields, which appear to be consistent with the
structure of the string spectrum.