Internal Server Error after upgrading to 4.1

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
I have upgraded my website from 3.9 to 4.0 then 4.1. Things worked as expected but the application throws an error while loading the list of plugins. Sometimes it loads the list of installed/ uninstalled plugins but most of the times it ends up with an internal server error.

I enabled the logs and found this stack trace.

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.OperationCanceledException: The operation was cancelled.
   at System.Net.HttpWebRequest.GetResponse()
   at Nop.Core.Plugins.OfficialFeedManager.GetDocument(String feedQuery, Object[] args) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Plugins\OfficialFeedManager.cs:line 25
   at Nop.Core.Plugins.OfficialFeedManager.GetCategories() in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Plugins\OfficialFeedManager.cs:line 56
   at Nop.Web.Areas.Admin.Factories.PluginModelFactory.PrepareOfficialFeedPluginSearchModel(OfficialFeedPluginSearchModel searchModel) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Areas\Admin\Factories\PluginModelFactory.cs:line 262
   at Nop.Web.Areas.Admin.Factories.PluginModelFactory.PreparePluginsConfigurationModel(PluginsConfigurationModel pluginsConfigurationModel) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Areas\Admin\Factories\PluginModelFactory.cs:line 357
   at Nop.Web.Areas.Admin.Controllers.PluginController.List() in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Areas\Admin\Controllers\PluginController.cs:line 111
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   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.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 94
   at Nop.Plugin.Api.ApiStartup.<>c.<<Configure>b__2_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Nop.Plugin.Api.IdentityServer.Middlewares.IdentityServerScopeParameterMiddleware.Invoke(HttpContext context)
   at Nop.Services.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 79
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Core.Http.InstallUrlMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Http\InstallUrlMiddleware.cs:line 51
   at Nop.Core.Http.KeepAliveMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Core\Http\KeepAliveMiddleware.cs:line 50
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (32ms) [Parameters=[@p0='?' (DbType = DateTime2), @p1='?' (DbType = Int32), @p2='?' (Size = -1), @p3='?' (Size = 200), @p4='?' (DbType = Int32), @p5='?' (Size = 4000), @p6='?' (Size = 4000), @p7='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
      SET NOCOUNT ON;
      INSERT INTO [Log] ([CreatedOnUtc], [CustomerId], [FullMessage], [IpAddress], [LogLevelId], [PageUrl], [ReferrerUrl], [ShortMessage])
      VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7);
      SELECT [Id]
      FROM [Log]
      WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();

Seems like it tries to access the folder location of developer machine. I downloaded the no-source latest copy from the official website.

any help to fix this issue.
5 years ago
I tried with source code copy and noticed applications got an error at line 25 of the GetDocument method in OfficialFeedManager partial class.

private static XmlDocument GetDocument(string feedQuery, params object[] args)
        {
            var request = WebRequest.Create(MakeUrl(feedQuery, args));
            request.Timeout = 3000;
            using (var response = request.GetResponse())
            {
                using (var dataStream = response.GetResponseStream())
                using (var reader = new StreamReader(dataStream))
                {
                    var responseFromServer = reader.ReadToEnd();

                    var xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(responseFromServer);
                    return xmlDoc;
                }
            }
        }
5 years ago
If GetResponse() is having issue, it means the API end point has issue (normally server 5XX or HTTP 4XX issues). So set your break point around that line, and see what's the exact issue.


5 years ago
I noticed this issue was because of my network provider somehow was not able to connect with the nopCommerce server. I switched to another internet provider and it works.

NopCommerce should give a bit descriptive message if anything like this happens.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.