我有实体框架 . 我写了一个获取序列的查询 . 我收到了这个错误 . 代码:

var rawQuery = _contextORA.Database.SqlQuery<int>("select SEQ_ID.NEXTVAL from dual");
var task = rawQuery.SingleAsync();
int nextVal = task.Result;
return nextVal.ToString();

end I get this error Message:

消息发生了一个或多个错误 . stackTrace:在System.Threading.Throws.ThrowIfException中的System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) . Boolean.BetResultCore(Boolean waitCompletionNotification)InnerException:System.InvalidCastException:指定的强制转换无效 .

update

我收到了错误

rawQuery.SingleAsync();

我能做什么?在本地计算机上它对我有用 . 但是当我将它分发给测试服务器时 - 它会收到错误 . (我在本地和测试中使用相同的DB)