Mr. Albanese had prepared for the debate in mock sessions with a long-shot Democratic candidate for public advocate, David Eisenbach, playing the role of Mr. de Blasio. For his part, the mayor held preparatory sessions before and after his vacation in Rhode Island last week, with a legislative aide, Jon Paul Lupo, playing Mr. Albanese.

But if the mayor came into the night intending to keep the focus on his record and avoid contentious arguments, as his campaign aides indicated, Mr. de Blasio instead went on offense, repeatedly and dismissively responding to Mr. Albanese’s attacks. The image on television presented a stark contrast: the 6-foot-5 mayor literally speaking down to his much shorter opponent.

Mr. Albanese, for his part, entered the debate enthusiastic to have a full 90 minutes with the mayor on stage to articulate his criticisms and vision for what he called “a more livable city.”

But for much of that time, he struggled to articulate a positive message for what he would do if elected mayor. At one point, Mr. Albanese adopted an idea he appeared to have first heard moments earlier from a journalist on the panel of questioners, WNYC’s Brian Lehrer, to address affordable housing by forcing developers to only create such housing. He stumbled as he explained his plan for “democracy vouchers,” to reduce the influence of donors, and did not fully explain a proposal for a “pied-à-terre tax” on real estate owned by non-city residents.

Perhaps the most pointed moments came on the subject of policing.

“If we had Mickey Mouse as the mayor, we’d still have crime going down,” Mr. Albanese said, before crediting the mayor for reviving a form of community policing. He said Mr. de Blasio had politicized the Police Department by criticizing the shooting of an unarmed woman in her home.

“I’m looking forward to the sentence where you have your facts straight,” Mr. de Blasio said. “She had a name: It was Deborah Danner.”