I am using a dropdown in a view which is as:
@Html.DropDownListFor(model => model.BankForProfileMIS, new SelectList(@FarmerProfiler.Common.CommonData.GetBanks()), "Select", new { id = "ddlBankForProfileMIS", style = "width:155px" })
GetBanks() retreives the list of banks from database which is as below:
static DataAccessLayer.DataAccess dataAccess = new DataAccessLayer.DataAccess();
public static List<string> GetBanks()
{
var Banklist = (from res in dataAccess.BankNames where res.StateId.ID == 147 select res.BankName).Distinct().OrderBy(m => m).ToList();
Banklist.Add("Other");
return Banklist;
}
Same code works fine in local and UAT server but in production it has started showing the following exception message recently:
"The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."
It used to work fine in production until yesterday. Can anyone please help in solve this problem?