Hi,
Sorry for the delay in my response. Had some issues on my projects to resolve. What we are trying to do is remove the standard ABP inclusion of jquery by ABP. This because we want to integrate Telerik components and for that to work the jquery.js must be put on the top of the page. We know about the option .Deferred() but that is not the way we want to solve this. The project has been migrated from 2.3 to 2.7 (both commercial) and within 2.3 it worked and with 2.7 (and 2.8) jquery is added by ABP dispite us removing it. We have a demo project (2.7 showcasing the issue and can be downloaded from (can be provided on request)
Alper mentioned we need to do this in the web project but we did. And again : this worked nicely with the 2.3 release.
Please find below the description as we reported this with the 2.7 / 2.8 Release.
@alper As reported with 2.7, the removed jquery.js is still added to the page. We have a demo project to show the issue (cannot attach), The given screenshots show you the issue we have found. We have also tested this with 2.8 with the same results. Seems like jquery gets added by abp modules. As you can see the jquery.js is added at the end of the chain of javascripts. This will cause issues because jquery should be added before any jquery dependant script or component.
Basic situation, clean new project without new bundles or removal contributor.
Situation after adding the removal contributor. The JQuery script has moved to the bottom of the script block.
Situation after adding the custom script layout hook. It does place the jquery script at the top. The “old” jquery script remains at the bottom.
ABP Framework version: v2.7.0
@alper Thanks, for pointing this out. I did not think of that. But even with this 'fix' it still does not work. Could you confirm this is an issue in the 2.7.0 ?
After upgrading form version 2.3 to 2.7, we encounter a problem in the BundleContributer. The below code worked with 2.3 but does not work with 2.7. Goal is to delete the jquery from the global script bundle and add it ourselves at the top of the page.
// delete jquery from the standard global scripts (will be added later by the Telerik Layout hook at the top of the page)
Configure<AbpBundlingOptions>(options =>
{
options
.ScriptBundles
.Configure(StandardBundles.Scripts.Global, bundle => {
bundle.AddContributors(typeof(Support.RemoveJqueryScriptContributor));
});
});
// Adds Telerik javascripts at the top of the page
Configure<AbpLayoutHookOptions>(options =>
{
options.Add(
LayoutHooks.Body.First,
typeof(TelerikControlsScriptsLayoutHook)
);
});
Implementation of the RemoveJqueryScriptContributor
public class RemoveJqueryScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.RemoveAll(x => x.StartsWith("/libs/jquery/jquery.js", StringComparison.InvariantCultureIgnoreCase));
}
}
In the actual page the the jquery is included (once at the top and once at the bottom). Setting a breakpoint on the RemoveAll however shows the jquery is removed from the context.Files. I would expect only one instance of jquery at the top of the page. Any ideas ?
Solved the issue. I created the database using the Package Manager Console. This however, does not seed the database. This was cuasing the null ref exception when starting the application.
Do not use PMC and always use the DbMigrator because that project also seeds the database.
My suggestion would be to remove the PMC method from the documentation.
Hi,
I have downloaded and created a tiered MVC application as instructed on the document pages. I am using the Commecrcial ABP ... so far so good. I have changed the appsettings.json to use localdb as below. "Default": "Server=(LocalDb)\MSSQLLocalDB;Database=Kantan;Trusted_Connection=True;MultipleActiveResultSets=true" Then I start the three projects within visual studio. (HttpApi.Host, IdentityServer and Web) I created the database using Migrations beforehand without any issues.
IdentityServers gives a blank page in the browser and the following error is logged in the log file :
2020-03-25 12:14:11.119 +01:00 [INF] Executed endpoint '/Account/Login'
2020-03-25 12:14:11.471 +01:00 [INF] Entity Framework Core 3.1.0 initialized 'AbpAuditLoggingDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
2020-03-25 12:14:11.810 +01:00 [INF] Executed DbCommand (13ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?' (Size = 96), @p2='?' (Size = 512), @p3='?' (Size = 64), @p4='?' (Size = 64), @p5='?' (Size = 128), @p6='?' (Size = 256), @p7='?' (Size = 4000), @p8='?' (Size = 64), @p9='?' (Size = 4000), @p10='?' (DbType = Int32), @p11='?' (DbType = DateTime2), @p12='?' (Size = 4000), @p13='?' (Size = 16), @p14='?' (DbType = Int32), @p15='?' (DbType = Guid), @p16='?' (DbType = Guid), @p17='?' (DbType = Guid), @p18='?' (Size = 4000), @p19='?' (Size = 256), @p20='?' (DbType = Guid), @p21='?' (Size = 256)], CommandType='"Text"', CommandTimeout='30']
SET NOCOUNT ON;
INSERT INTO [AbpAuditLogs] ([Id], [ApplicationName], [BrowserInfo], [ClientId], [ClientIpAddress], [ClientName], [Comments], [ConcurrencyStamp], [CorrelationId], [Exceptions], [ExecutionDuration], [ExecutionTime], [ExtraProperties], [HttpMethod], [HttpStatusCode], [ImpersonatorTenantId], [ImpersonatorUserId], [TenantId], [TenantName], [Url], [UserId], [UserName])
VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20, @p21);
2020-03-25 12:14:11.882 +01:00 [DBG] Added 0 entity changes to the current audit log
2020-03-25 12:14:11.882 +01:00 [DBG] Added 0 entity changes to the current audit log
2020-03-25 12:14:11.898 +01:00 [ERR] Connection ID "17798225737568747535", Request ID "80000010-0002-f700-b63f-84710c7967bb": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
at AspNetCore._Themes_Lepton_Components_Toolbar_LanguageSwitch_Default.ExecuteAsync() in /Themes/Lepton/Components/Toolbar/LanguageSwitch/Default.cshtml:line 5
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ExecuteAsync(ViewComponentContext context)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpViewComponentHelper.InvokeAsync(Type componentType, Object arguments)
at AspNetCore._Themes_Lepton_Layouts_Account_Default.<>c__DisplayClass17_0.<<ExecuteAsync>b__7>d.MoveNext() in /Themes/Lepton/Layouts/Account/Default.cshtml:line 81
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
at AspNetCore._Themes_Lepton_Layouts_Account_Default.<>c__DisplayClass17_0.<<ExecuteAsync>b__3>d.MoveNext() in /Themes/Lepton/Layouts/Account/Default.cshtml:line 68
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
at AspNetCore._Themes_Lepton_Layouts_Account_Default.<>c__DisplayClass17_0.<<ExecuteAsync>b__1>d.MoveNext() in /Themes/Lepton/Layouts/Account/Default.cshtml:line 66
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
at AspNetCore._Themes_Lepton_Layouts_Account_Default.ExecuteAsync() in /Themes/Lepton/Layouts/Account/Default.cshtml:line 34
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable1 statusCode) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable
1 statusCode)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|27_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
at IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
2020-03-25 12:14:11.973 +01:00 [INF] Request finished in 8996.1172ms 500
Am I doing something wrong ?