NullReferenceException:对象引用未设置为对象的实例。 Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest.get_Query()

时间:2018-07-09 05:23:23

标签: .net asp.net-core-2.0 .net-framework-version

[该项目是针对.NET Framework 4.6.1的ASP.NET核心项目。

在运行网站时,所有页面都可以正常运行,只是几次会在几个页面上出现NullReference异常。请让我知道是否有人遇到过此问题以及如何解决?谢谢。 我已经在GitHub上看到了一些类似的问题,但是没有提供具体的解决方案。

NullReferenceException: Object reference not set to an instance of an object.
Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest.get_Query()
Stack Query Cookies Headers 
NullReferenceException: Object reference not set to an instance of an object.
Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest.get_Query()      
Microsoft.AspNetCore.Mvc.ModelBinding.QueryStringValueProviderFactory.CreateValue    
ProviderAsync(ValueProviderFactoryContext context)
Microsoft.AspNetCore.Mvc.ModelBinding.CompositeValueProvider.CreateAsync(ActionContext actionContext, IList<IValueProviderFactory> factories)
Microsoft.AspNetCore.Mvc.ModelBinding.CompositeValueProvider.CreateAsync(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Internal.ControllerBinderDelegateProvider+<>c__DisplayClass0_0+<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

)][1]

Links

0 个答案:

没有答案