DALLAS — Beset by hard-to-keep promises and a massive website failure, President Barack Obama traveled to the heart of the “Obamacare” opposition Wednesday, declaring that ideological rigidity was denying health insurance to millions of Americans.

Ad-libbing at a synagogue in Dallas, Obama said he was the first to admit he was unhappy with the rocky first month since new insurance exchanges went live.

He implored volunteers and guides who are working to help consumers to stick with it, casting it as an effort that would, eventually, be well worth the trouble.

“As challenging as this may seem sometimes, as frustrating as healthcare.gov may be sometimes, we are going to get this done,” Obama said.

The visit also cast a bright light on staunch opposition to the law in Republican-leaning Texas, which has the highest rate of uninsured Americans — more than 23 percent. But GOP Gov. Rick Perry and the Texas Legislature have refused to take advantage of a provision in the law to expand Medicaid to cover more of the working poor.

Obama said Texas’ neighbors had looked at the Medicaid expansion, which is fully funded by the federal government for the first few years, as a no-brainer.

“Why wouldn’t the state of Texas want to do the same thing?” he asked later at a fundraiser for the Democratic Senatorial Campaign Committee. “Well, it’s because ideology has taken precedence over common sense and helping people.”

The trip to Texas — initially scheduled only as a fundraising visit — comes as his administration seeks to mitigate the damage from the website glitches and from a public outcry over a promise he repeatedly made — if you like your insurance, you can keep it — that turned out to be incorrect for millions of Americans.

Before leaving Washington on Wednesday, Obama tried to soothe the concerns of 16 Senate Democrats facing re-election next year during a two-hour White House meeting. Many of those lawmakers are worried that the problem-plagued rollout could negatively affect their races.

Later, at one of two fundraisers, he said: “It is fair to say that right now I’m not happy with some IT people in Washington.”

Highlighting the law’s benefits at Dallas Temple Emanu-El, Obama encouraged participation in the marketplaces set up by the law. He said nothing drives him crazier than knowing there’s good insurance available — if only the website would work properly.

“This is like having a really good product in a store, and the cash registers don’t work, and there aren’t enough parking spots,” Obama said.

“I know that sometimes this task is especially challenging here in the great Lone Star State,” Obama said to laughter. “But I think all of you understand that there’s no state that actually needs this more than Texas.”

Perry shot back, accusing Obama in a statement of trying to “salvage his ill-conceived and unpopular program from a Titanic fate.”

“Texans aren’t the reason Obamacare is crumbling,” Perry said. “Obamacare is the reason Obamacare is crumbling.”

Texas also is among the 36 states not providing their own insurance marketplaces, which means residents there must sign up through the federal website that stumbled badly upon its launch Oct. 1.