WASHINGTON — Members of Congress from both parties expressed immense frustration on Wednesday at big increases in insulin prices and vowed to work together on legislation to prevent more people from dying because they could not afford the lifesaving medicine.

Representative Earl L. Carter, Republican of Georgia, said at the end of a three-hour hearing with pharmaceutical executives and middlemen, known as pharmacy benefit managers, “You’ve done something here today that we’ve been trying to do in Congress for years, and that is to create bipartisanship.”

“This is going to end,” Mr. Carter, known as Buddy, said of the convoluted arrangements that drive up list prices of insulin and the out-of-pocket costs for many people with diabetes.

The hearing was one of several indications that Congress was serious about trying to address the cries of distress from constituents unable to afford the medicines they need.