Defense against attaching-and-effacing bacteria requires the sequential generation of interleukin 23 (IL-23) and IL-22 to induce protective mucosal responses. Although CD4+ and NKp46+ innate lymphoid cells (ILCs) are the critical source of IL-22 during infection, the precise source of IL-23 is unclear. We used genetic techniques to deplete mice of specific subsets of classical dendritic cells (cDCs) and analyzed immunity to the attaching-and-effacing pathogen Citrobacter rodentium. We found that the signaling receptor Notch2 controlled the terminal stage of cDC differentiation. Notch2-dependent intestinal CD11b+ cDCs were an obligate source of IL-23 required for survival after infection with C. rodentium, but CD103 + cDCs dependent on the transcription factor Batf3 were not. Our results demonstrate a nonredundant function for CD11b+ cDCs in the response to pathogens in vivo.