Base solution for your next web application
Open Closed

ASPNETZERO v4.1.1 Internal Server Error in Host Admin site #3460


User avatar
0
riaan created

Hi,

I've migrated the v4.1.1 code into my current application but encountered an Internal Server Error in the Host Admin Site. Thinking I made a mistake, I've downloaded the latest v4.1.1 code and ran it as a clean installation (without any modifications) and still encountered the Internal Server Error when signing into the Host Admin site.

Below traces of the web requests that gives the Internal Server Error, as well as a log extract, and the code portion I was able to trace where the exception occurs.

HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Server: Kestrel
X-SourceFiles: =?UTF-8?B?QzpcVGVtcFxhc3BuZXQtY29yZVxzcmNcTXlDb21wYW55TmFtZS5BYnBaZXJvVGVtcGxhdGUuV2ViLk12Y1xhcGlcc2VydmljZXNcYXBwXFRlbmFudFxHZXRUZW5hbnRz?=
X-Powered-By: ASP.NET
Date: Tue, 27 Jun 2017 20:58:55 GMT

cf
{"result":null,"targetUrl":null,"success":false,"error":{"code":0,"message":"An internal error occurred during your request!","details":null,"validationErrors":null},"unAuthorizedRequest":false,"__abp":true}
0
INFO  2017-06-27 22:24:54,089 [93   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method MyCompany.AbpZeroTemplate.MultiTenancy.HostDashboard.HostDashboardAppService.GetDashboardStatisticsData (MyCompany.AbpZeroTemplate.Application) with arguments (MyCompany.AbpZeroTemplate.MultiTenancy.HostDashboard.Dto.GetDashboardDataInput) - ModelState is Valid
ERROR 2017-06-27 22:24:55,420 [102  ] Mvc.ExceptionHandling.AbpExceptionFilter - Incorrect syntax near 'OFFSET'.
Invalid usage of the option NEXT in the FETCH statement.
System.Data.SqlClient.SqlException: Incorrect syntax near 'OFFSET'.
Invalid usage of the option NEXT in the FETCH statement.
   at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__107_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<BufferlessMoveNext>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__6`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.&lt;MoveNext&gt;d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.<MoveNext>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.&lt;MoveNext&gt;d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<MoveNext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.<ToListAsync>d__129`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MyCompany.AbpZeroTemplate.Authorization.Users.UserLinkAppService.<GetRecentlyUsedLinkedUsers>d__8.MoveNext() in MyCompany.AbpZeroTemplate.Application\Authorization\Users\UserLinkAppService.cs:line 95
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__38`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeNextExceptionFilterAsync&gt;d__24.MoveNext()
ClientConnectionId:f4add014-f6fe-4e6c-a301-971708f04b74
Error Number:102,State:1,Class:15

I was able to trace the exception to this section of the code:

public async Task&lt;GetNotificationsOutput&gt; GetUserNotifications(GetUserNotificationsInput input)
        {
            var totalCount = await _userNotificationManager.GetUserNotificationCountAsync(
                AbpSession.ToUserIdentifier(), input.State
                );

            var unreadCount = await _userNotificationManager.GetUserNotificationCountAsync(
                AbpSession.ToUserIdentifier(), UserNotificationState.Unread
                );

            var notifications = await _userNotificationManager.GetUserNotificationsAsync(
                AbpSession.ToUserIdentifier(), input.State, input.SkipCount, input.MaxResultCount
                );  // <-- This is where the exception occurs

            return new GetNotificationsOutput(totalCount, unreadCount, notifications);
        }

Any assistance would be appreciated

Thanks,

Riaan


6 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Which version of SQL Server are you using?

  • User Avatar
    0
    riaan created

    Hi,

    Herewith my SQL version

    Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) Mar 29 2009 10:11:52 Copyright (c) 1988-2008 Microsoft Corporation Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

  • User Avatar
    0
    alirizaadiyahsi created

    it looks its about your SQL Server version.

    Generated SQL by EF is not compatible with your SQL server version.

    Check following links: <a class="postlink" href="https://github.com/aspnet/EntityFramework/issues/4616">https://github.com/aspnet/EntityFramework/issues/4616</a> <a class="postlink" href="https://stackoverflow.com/questions/29995502/paging-with-entity-framework-7-and-sql-server-2008">https://stackoverflow.com/questions/299 ... erver-2008</a>

    By the way, if we find any workaround on this, we will share it.

  • User Avatar
    0
    riaan created

    Thanks.

    I will upgrade to a newer version. Luckily my other dev machine and our production environment is on a higher version of SQL.

    Thanks for the assistance.

    Riaan

  • User Avatar
    0
    riaan created

    Success !!! Upgraded SQL 2008 to SQL 2014 and the Internal Server Error issue has been resolved. Thanks for the assistance.

    Riaan

  • User Avatar
    0
    alirizaadiyahsi created

    Great. Glad, it helped.