Preheat the oven to 400 degrees F.
For the crispy shallot topping: Line a plate with paper towels. Put the shallots in a small saucepan and pour in canola or vegetable oil to cover. Put the pan on the stove, turn the heat to medium and cook, stirring occasionally, until the shallots turn a medium brown, about 4 minutes. Drain them in a fine-mesh sieve, reserving the oil for another use, then turn the shallots onto the paper-lined plate and blot with another paper towel. Sprinkle with salt and set aside.
For the green bean casserole: Fill a large bowl with water and some ice. Bring a large pot of salted water to a boil.
Plunge the green beans into the boiling water and cook just until crisp-tender, about 5 minutes. Drain, then plunge them into the ice water to stop the cooking. Drain again.
Butter a shallow 3-quart casserole and set aside.
Melt the butter in a large skillet. Saute the mushrooms until browned and any liquid they have released has evaporated, about 6 minutes. Add the minced shallots and saute until slightly softened, another 2 minutes. Sprinkle over the flour and continue to saute until the flour coats the mushrooms well and turns golden, another 2 minutes. Slowly pour in the broth while stirring. Stir in the half-and-half and continue to cook, stirring frequently, until the liquid has thickened. Add the partially cooked green beans, then turn the mixture into the prepared casserole.
Bake until hot and bubbly, about 15 minutes. Sprinkle over the reserved crispy shallots and bake until the shallots are hot and re-crisped, about 5 more minutes. Garnish with fresh parsley or chervil if desired and serve hot.