I'm getting a System.ObjectDisposedException with the following code:
using (AdminServiceClient web Service = new AdminServiceClient)
{
webService.Open();
...
var jsonToReturn = new {
...
data = addresses.Select(address => new string [] {
...
webService.GetAddressName(address.id)
...
}) // running the code results in the exception here
};
return Json(jsonToReturn, JsonRequestBehavior.AllowGet);
}
I'm assuming the exception comes from that one method call to GetAddressName(). Is there any way to force the execution of that method before exiting the using block?