The production of D-+/-- and D-0-mesons has been measured with the ZEUS detector at HERA using an integrated luminosity of 133.6 pb(-1). The measurements cover the kinematic range 5 < Q(2) < 1000 GeV2, 0.02 < y < 0.7, 1.5 < p(T)(D) < 15 GeV and |eta(D)| < 1.6. Combinatorial background to the D-meson signals is reduced by using the ZEUS microvertex detector to reconstruct displaced secondary vertices. Production cross sections are compared with the predictions of next-to-leading-order QCD, which is found to describe the data well. Measurements are extrapolated to the full kinematic phase space in order to obtain the open-charm contribution, F-2(c (c) over bar), to the proton structure function, F-2.