In my local computer with Windows 11, visual studio 2022, I create a project API REST and I have a request to the database, something like this
result = await appDb.table
.Skip(data.Index)
.Where(something here)
.Take(data.NumberToTake)
.ToListAsync();
it works fine in my local computer, but when I publish the code to my IIS 7.5, windows server 2008 R2, gives me this error:
Microsoft.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near 'OFFSET'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
if I change my code and erase the skip command it works well. I understand that the problem is the version but I don't know how to get the .net core version that is using the IIS 7.5 (some time ago I install a bundle to allow the run of asp.net Core projects, but don't know which version is running actually) or maybe is something else.
Edit: this is the bundle I install to run .net core: https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-6.0.4-windows-hosting-bundle-installer
Any ideas of what can I do?
At the end what I do was:
Result = await appDb.Table
.Where(...)
//.Skip(data.Index)
//.Take(data.NumberToTake)
.ToListAsync();
Result = Result.Skip(data.Index).Take(data.NumberToTake).ToList();
Is inefficient but until I find a better way, this works for now.