Semiconductor heterostructures are backbones for solid state based optoelectronic devices. Recent advances in assembly techniques for van der Waals heterostructures has enabled the band engineering of semiconductor heterojunctions for atomically thin optoelectronic devices. In two-dimensional heterostructures with type II band alignment, interlayer excitons, where Coulomb-bound electrons and holes are confined to opposite layers, have shown promising properties for novel excitonic devices, including a large binding energy, micron-scale in-plane drift-diffusion, and long population and valley polarization lifetime. Here, we demonstrate interlayer exciton optoelectronics based on electrostatically defined lateral p-n junctions in a MoSe2-WSe2 heterobilayer. Applying a forward bias enables the first observation of electroluminescence from interlayer excitons. At zero bias, the p-n junction functions as a highly sensitive photodetector, where the wavelength-dependent photocurrent measurement allows the direct observation of resonant optical excitation of the interlayer exciton. The resulting photocurrent amplitude from the interlayer exciton is about 200 times smaller compared to the resonant excitation of intralayer exciton. This implies that the interlayer exciton oscillator strength is two orders of magnitude smaller than that of the intralayer exciton due to the spatial separation of electron and hole to opposite layers. These results lay the foundation for exploiting the interlayer exciton in future 2D heterostructure optoelectronic devices.