Complete noncompact manifolds with harmonic curvature