A "signal-on" photoelectrochemical (PEC) immunosensor for highly sensitive detection of Human Epididymis Protein 4 (HE4), a new serum biomarker of ovarian cancer with small molecular weight, was fabricated by coupling the porphyrin-based metal-organic framework (MOF) nanosphere (nPCN-224) and Nanobody (Nb). To label the Nb, the nPCN-224 with an average size of 160-200 nm was prepared by solvothermal method. The mechanism for the photocurrent generation of nPCN-224 was systematically investigated, showing that the dissolved O