We have migrated to the latest version i.e. v7.0 and using the Angular-.net core template.
Just like we can create custom sessions in asp.net web forms eg. Session["UserSpecificStates"] = "New York, Alabama", we want to create similar session/ claims in aspnetzero.
There is no proper documentation available for custom claims/session in abp.
Can anyone please share how this can be implemented.
Thanks in advance.
Hello All,
We are trying to deploy a website developed using aspnetzero in angular and .net core.
Have recently upgraded the aspnetzero framework to 6.9.1 and are following the below steps to deploy it in IIS:
Doing all this setup we are able to browse the application but when we hit the URL it is showing the site is not secure (as shown below).
We have already gone through the deployment steps mentioned on the aspnetzero documents portal but they are very basic and are not helping in solving our issue:
https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Deployment-Angular-Publish-IIS#angular-application-publishing
While doing this deployment we have a come up with few queries:
I've heard it will be available with Angular 8 as an opt-in.Are we going to integrate anytime soon with ASP NET Zero Angular.
We have implemented AspNetZero Angular-.netCore template in our project and below is the folder structure of components:
Maintenance(Parent) |-- Campaigns | |-- campaigns.component.ts | |--add-edit-campaigns.component.ts | |--add-edit-segments.component.ts | |--campaigns.module.ts | |--campaigns-routing.modules.ts | |-- AdGroups | |--adgroups.component.ts | |--add-edit-adgroups.component.ts | |--adgroups.module.ts | |--adgroups-routing.module.ts | |--Keywords | |--keywords.component.ts | |--add-edit-keywords.component.ts | |--keywords.module.ts | |--keyword-routing.module.ts
We have already implemented modules lazy loading. We now need to implement dynamic component loading of modals as in case of the Campaigns, the components would increase exponentially as we proceed with the development.
So as per the current implementation, when the campaigns.component is loading, along with this the add-edit-campaigns.component and add-edit-segment component is also getting pre-loaded in the DOM as both are modal components.
As the number of modal components would increase, all these components would be pre-loaded in the DOM which would hamper the performance.
Could you please help us out and explain how can we implement Dynamic component of modals.
Using the aspnetzero RAD tools we have created a component and its back-end services. The functionality is working as desired. Now we are trying to write unit tests in jasmine for this particular component. For this we have created a new spec.ts file and import all the required dependencies. We need to create mock service to bind mock data on page load.
We followed a few of the posts mentioned below of how to mock the back end services: <a class="postlink" href="https://codecraft.tv/courses/angular/unit-testing/mocks-and-spies/">https://codecraft.tv/courses/angular/un ... and-spies/</a> <a class="postlink" href="https://alligator.io/angular/testing-with-spies/">https://alligator.io/angular/testing-with-spies/</a>
We are facing issue creating the mock service and consuming the same in the describe function. Below is the component.ts code
import { Component, Injector, ViewEncapsulation, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Http } from '@angular/http';
import { DatabasesServiceProxy, DatabaseDto } from '@shared/service-proxies/service-proxies';
import { NotifyService } from '@abp/notify/notify.service';
import { AppComponentBase } from '@shared/common/app-component-base';
import { TokenAuthServiceProxy } from '@shared/service-proxies/service-proxies';
import { CreateOrEditDatabaseModalComponent } from './create-or-edit-database-modal.component';
import { ViewDatabaseModalComponent } from './view-database-modal.component';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { DataTable } from 'primeng/components/datatable/datatable';
import { Paginator } from 'primeng/components/paginator/paginator';
import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent';
import { FileDownloadService } from '@shared/utils/file-download.service';
import * as moment from 'moment';
@Component({
templateUrl: './databases.component.html',
encapsulation: ViewEncapsulation.None,
animations: [appModuleAnimation()]
})
export class DatabasesComponent extends AppComponentBase {
@ViewChild('createOrEditDatabaseModal') createOrEditDatabaseModal: CreateOrEditDatabaseModalComponent;
@ViewChild('viewDatabaseModalComponent') viewDatabaseModal: ViewDatabaseModalComponent;
@ViewChild('dataTable') dataTable: DataTable;
@ViewChild('paginator') paginator: Paginator;
advancedFiltersAreShown = false;
filterText = '';
lK_DatabaseTypeFilter = '';
cDatabaseNameFilter = '';
cListFileUploadedPathFilter = '';
cListReadyToLoadPathFilter = '';
maxdCreatedDateFilter : moment.Moment;
mindCreatedDateFilter : moment.Moment;
cCreatedByFilter = '';
maxdModifiedDateFilter : moment.Moment;
mindModifiedDateFilter : moment.Moment;
cModifiedByFilter = '';
lK_AccountingDivisionCodeFilter = '';
cAdministrationEmailFilter = '';
divisioncDivisionNameFilter = '';
constructor(
injector: Injector,
private _http: Http,
private _databasesServiceProxy: DatabasesServiceProxy,
private _notifyService: NotifyService,
private _tokenAuth: TokenAuthServiceProxy,
private _activatedRoute: ActivatedRoute,
private _fileDownloadService: FileDownloadService
)
{
super(injector);
}
getDatabases(event?: LazyLoadEvent) {
if (this.primengDatatableHelper.shouldResetPaging(event)) {
this.paginator.changePage(0);
return;
}
this.primengDatatableHelper.showLoadingIndicator();
this._databasesServiceProxy.getAll(
this.filterText,
this.lK_DatabaseTypeFilter,
this.cDatabaseNameFilter,
this.cListFileUploadedPathFilter,
this.cListReadyToLoadPathFilter,
this.maxdCreatedDateFilter,
this.mindCreatedDateFilter,
this.cCreatedByFilter,
this.maxdModifiedDateFilter,
this.mindModifiedDateFilter,
this.cModifiedByFilter,
this.lK_AccountingDivisionCodeFilter,
this.cAdministrationEmailFilter,
this.cAdministrationEmailFilter,
null,
this.primengDatatableHelper.getSorting(this.dataTable),
this.primengDatatableHelper.getSkipCount(this.paginator, event),
this.primengDatatableHelper.getMaxResultCount(this.paginator, event)
).subscribe(result => {
this.primengDatatableHelper.totalRecordsCount = result.totalCount;
this.primengDatatableHelper.records = result.items;
this.primengDatatableHelper.hideLoadingIndicator();
});
}
reloadPage(): void {
this.paginator.changePage(this.paginator.getPage());
}
createDatabase(): void {
this.createOrEditDatabaseModal.show();
}
deleteDatabase(database: DatabaseDto): void {
this.message.confirm(
'',
(isConfirmed) => {
if (isConfirmed) {
this._databasesServiceProxy.delete(database.id)
.subscribe(() => {
this.reloadPage();
this.notify.success(this.l('SuccessfullyDeleted'));
});
}
}
);
}
exportToExcel(): void {
this._databasesServiceProxy.getDatabasesToExcel(
this.filterText,
this.lK_DatabaseTypeFilter,
this.cDatabaseNameFilter,
this.cListFileUploadedPathFilter,
this.cListReadyToLoadPathFilter,
this.maxdCreatedDateFilter,
this.mindCreatedDateFilter,
this.cCreatedByFilter,
this.maxdModifiedDateFilter,
this.mindModifiedDateFilter,
this.cModifiedByFilter,
this.lK_AccountingDivisionCodeFilter,
this.cAdministrationEmailFilter,
this.divisioncDivisionNameFilter,
)
.subscribe(result => {
this._fileDownloadService.downloadTempFile(result);
});
}
}
could you please help us on this.
Have setup SQL Server 2016 standard edition on my local machine and added the below connection string in the appsettings.json file:
"Default": "Server=SUMITSH-W10\SQL2016; Database=IDMS_vNext_AspNetZero; Trusted_Connection=True;"
If, am not using the named instance of DB, the code works as desired and am able to connect with the DB.
"Default": "Server=SUMITSH-W10; Database=Dw_Admin_AspNetZero_Schema; Trusted_Connection=True;"
Not sure, if defining the connection string for the named instance correctly.
This is giving me error as below:
An error occurred while starting the application.
SqlException: Invalid object name 'AbpEditions'.
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
SqlException: Invalid object name 'AbpEditions'.
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, bool callerHasConnectionLock, bool asyncClose)
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, out bool dataReady)
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
System.Data.SqlClient.SqlDataReader.get_MetaData()
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, string resetOptionsString)
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, bool async, int timeout, out Task task, bool asyncWrite, SqlDataReader ds)
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, TaskCompletionSource<object> completion, int timeout, out Task task, bool asyncWrite, string method)
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
System.Data.Common.DbCommand.ExecuteReader()
Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary<string, object> parameterValues)
Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues)
Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable+Enumerator.BufferlessMoveNext(bool buffer)
Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute<TState, TResult>(TState state, Func<DbContext, TState, TResult> operation, Func<DbContext, TState, ExecutionResult<TResult>> verifySucceeded)
Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable+Enumerator.MoveNext()
System.Linq.Enumerable.TryGetFirst<TSource>(IEnumerable<TSource> source, out bool found)
lambda_method(Closure , QueryContext )
Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler+<>c__DisplayClass17_1.<CompileQueryCore>b__0(QueryContext qc)
Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute<TResult>(Expression query)
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute<TResult>(Expression expression)
System.Linq.Queryable.FirstOrDefault<TSource>(IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
Infogroup.IDMS.Migrations.Seed.Host.DefaultEditionCreator.CreateEditions() in DefaultEditionCreator.cs + 26. var defaultEdition = _context.Editions.IgnoreQueryFilters().FirstOrDefault(e => e.Name == EditionManager.DefaultEditionName);
Infogroup.IDMS.Migrations.Seed.Host.DefaultEditionCreator.Create() in DefaultEditionCreator.cs + 21. CreateEditions();
Infogroup.IDMS.Migrations.Seed.Host.InitialHostDbBuilder.Create() in InitialHostDbBuilder.cs + 16. new DefaultEditionCreator(_context).Create();
Infogroup.IDMS.Migrations.Seed.SeedHelper.SeedHostDb(IDMSDbContext context) in SeedHelper.cs + 26. new InitialHostDbBuilder(context).Create();
Infogroup.IDMS.Migrations.Seed.SeedHelper.WithDbContext<TDbContext>(IIocResolver iocResolver, Action<TDbContext> contextAction) in SeedHelper.cs + 42. contextAction(context);
Infogroup.IDMS.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in SeedHelper.cs + 18. WithDbContext<IDMSDbContext>(iocResolver, SeedHostDb);
Infogroup.IDMS.EntityFrameworkCore.IDMSEntityFrameworkCoreModule.PostInitialize() in IDMSEntityFrameworkCoreModule.cs + 58. SeedHelper.SeedHostDb(IocManager);
System.Collections.Generic.List.ForEach(Action<T> action)
Abp.AbpBootstrapper.Initialize() in AbpBootstrapper.cs
Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action<AbpApplicationBuilderOptions> optionsAction) in AbpApplicationBuilderExtensions.cs
Infogroup.IDMS.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in Startup.cs + 149. app.UseAbp(options =>
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsLoggerStartupFilter+<>c__DisplayClass0_1.<Configure>b__0(IApplicationBuilder builder)
Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.<Configure>b__0(IApplicationBuilder app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Show raw exception details
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpEditions'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary
2 parameterValues)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable
1.Enumerator.BufferlessMoveNext(Boolean buffer)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func
3 verifySucceeded)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.MoveNext() at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable
1 source, Boolean& found)
at lambda_method(Closure , QueryContext )
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_11.<CompileQueryCore>b__0(QueryContext qc) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable
1 source, Expression1 predicate) at Infogroup.IDMS.Migrations.Seed.Host.DefaultEditionCreator.CreateEditions() in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\Host\DefaultEditionCreator.cs:line 26 at Infogroup.IDMS.Migrations.Seed.Host.DefaultEditionCreator.Create() in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\Host\DefaultEditionCreator.cs:line 21 at Infogroup.IDMS.Migrations.Seed.Host.InitialHostDbBuilder.Create() in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\Host\InitialHostDbBuilder.cs:line 16 at Infogroup.IDMS.Migrations.Seed.SeedHelper.SeedHostDb(IDMSDbContext context) in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 26 at Infogroup.IDMS.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action
1 contextAction) in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 42
at Infogroup.IDMS.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 18
at Infogroup.IDMS.EntityFrameworkCore.IDMSEntityFrameworkCoreModule.PostInitialize() in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.EntityFrameworkCore\EntityFrameworkCore\IDMSEntityFrameworkCoreModule.cs:line 58
at System.Collections.Generic.List1.ForEach(Action
1 action)
at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 160
at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction) in D:\Github\aspnetboilerplate\src\Abp.AspNetCore\AspNetCore\AbpApplicationBuilderExtensions.cs:line 37
at Infogroup.IDMS.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in D:\Development\IDMS_vNext\IDMS\src\Infogroup.IDMS.Web.Host\Startup\Startup.cs:line 149
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsLoggerStartupFilter.<>c__DisplayClass0_1.
**If, am not using the named instance of DB, the code works as desired and am able to connect with the DB.
"Default": "Server=SUMITSH-W10; Database=Dw_Admin_AspNetZero_Schema; Trusted_Connection=True;"
Not sure, if defining the connection string for the named instance correctly.**