ABP Framework version: v5.0.1
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
Steps to reproduce the issue:"
added below code in Service file in Angular :
notificationHub: HubConnection;
configureConnection(): void {
// Set the common hub
const connection = new signalR.HubConnectionBuilder()
.withUrl(environment.apis.NotificationService.url + '/signalr-hubs/notification', { accessTokenFactory: () => this.OAuth.getAccessToken() })
.build();
this.notificationHub = connection;
// Reconnect loop
let reconnectTime = 5000;
let tries = 1;
let maxTries = 8;
start().then(() => {
this.isNotificationConnected = true;
this.registerNotificationEvents(connection);
}).catch(error => {
});
function start() {
return new Promise(function (resolve, reject) {
if (tries > maxTries) {
reject();
} else {
connection.start()
.then(resolve)
.then(() => {
reconnectTime = 5000;
tries = 1;
})
.catch(() => {
setTimeout(() => {
start().then(resolve);
}, reconnectTime);
reconnectTime \*= 2;
tries += 1;
});
}
});
}
// Reconnect if hub disconnects
connection.onclose(e => {
this.isNotificationConnected = false;
start().then(() => {
this.isNotificationConnected = true;
});
});
}
In Backend
added NotificationHub class like this.
[Authorize]
public class NotificationHub : AbpHub
{
}
and In hostmodulefile added Authentication :
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "NotificationService";
options.Events = new JwtBearerEvents
{
OnMessageReceived = context =>
{
string accessToken = context.Request.Headers["Authorization"];
string hangfireToken = context.Request.QueryString.Value.Replace("?access\_token=", "");
// If the request is for our hub...
var path = context.HttpContext.Request.Path;
if (!string.IsNullOrEmpty(accessToken) &&
path.StartsWithSegments("/signalr-hubs/notification"))
{
// Read the token out of the query string
context.Token = accessToken.Replace("Bearer ", "");
}
return Task.CompletedTask;
}
};
});
We have a commercial microservice template on which we are doing Integration Testing but due to below error not able to move forward.
When we try to debug Test, call goes to below function then on next process it throws error.
`private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open();
new TestServiceDbContext(
new DbContextOptionsBuilder<TestServiceDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
return connection;
}
`
Could you please provide Quick fix on this issue.
JwtBearerConfigurationHelper.Configure(context, "TestService");
SwaggerConfigurationHelper.Configure(context, "TestService API");``
context.Services.AddHangfire(config => { config.UseSqlServerStorage(configuration.GetConnectionString("TestService")); });
app.UseHangfireDashboard("/hangfire", new DashboardOptions { AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(requiredPermissionName: "Hangfire.Dashboard") } });
After adding an above line not able to see Hangfire Dashboard. Permission is applied for the user but still not able to view Dashboard page.
Couldn't determinate version of "@abp/ng.schematics" package. "SchematicsAbpGenerateProxy" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID. Cannot read property 'push' of undefined
Requesting you to provide solution on this. We go through all proxy related documents but not able solve it.
I am using Microservice template and able to run it successfully now i want make changes in in PreBuilt Module pages for i need source of it.
or What should i refer to make changes in Account, Indentity, Indentity Server pages in Commercial Microservice Template
When User redirects to the unauthorize page, access denied pages comes. i want to add custom page which will redirect user to that page.
e.g. I dont have permissions to Identity/Users page then i want to redirect user to different page or how can overide the existing Account/AccessDenied page?
@maliming In ABP.IO we are creating an entities like this which supports repository pattern.
public class Book : Entity<long> { public string Name { get; set; }
public float Price { get; set; }
}
private readonly IRepository<Book,long> _bookRepository;
but i want to create a class which will not inherit Entity.
public class Book { public long Id {get;set;}
public string Name { get; set; }
public float Price { get; set; }
}
private readonly IRepository<Book,long> _bookRepository it gives erros at this line if we didnt pass Entity.
can i use this class with Repository pattern and if not then what approach should i take.
waiting for your urgent response.
We have followed this document link https://docs.abp.io/en/abp/latest/Background-Jobs to crate a job and implemented exactly like this but somehow that job is not getting triggered and as soon as entry get added in Background Table IsAbandoned flag set to true. Sometimes we also observed this behaviour is that it suddendly start executing job and again stopped working. Cean -> rebuild- > build project is working some times. its a weird things we are obeserving. Here is the sample code,
public enum ImportTableName
{
Test1 = 1,
Test2 = 2
}
[BackgroundJobName("ImportJob")]
public class BackgroundImportJobArgs
{
public string FilePath { get; set; }
public ImportTableName ImportTableName { get; set; }
}
public class BackgroundImportJob : AsyncBackgroundJob<BackgroundImportJobArgs>, ITransientDependency
{
private readonly IImportTblAppService importTbl;
public BackgroundImportJob(IImportTblAppService importTbl)
{
this.importTbl = importTbl;
}
public override async Task ExecuteAsync(BackgroundImportJobArgs args)
{
switch (args.ImportTableName)
{
case ImportTableName.Test1:
await importTbl.AddTest1(args.FilePath, args.ImportTableName);
System.IO.File.Delete(args.FilePath);
break;
default:
break;
}
}
}
public class ImportTblAppService : DemoAppService, IImportTblAppService
{
private readonly ITest1Repository _test1Repository;
private readonly IBackgroundJobManager _backgroundJobManager;
public ImportTblAppService(ITest1Repository test1Repository, IBackgroundJobManager backgroundJobManager)
{
_test1Repository = test1Repository;
_backgroundJobManager = backgroundJobManager;
}
public async Task AddTest1(string filePath, ImportTableName tablename)
{
/* Here contains Insert Logic */
}
public async Task ScheduleImportJob(string filePath, ImportTableName tablename)
{
await _backgroundJobManager.EnqueueAsync(new BackgroundImportJobArgs { FilePath = filePath, ImportTableName = tablename }).ConfigureAwait(false);
}
}
ABP Framework version: v3.1.2
UI type: MVC
Tiered (MVC): / no
Exception message and stack trace: 2020-10-07 04:23:16.969 +00:00 [ERR] Command aggregate failed: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason:** (Message: {"Errors":["The index path corresponding to the specified order-by item is excluded."]}
ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4, Request URI: /apps/c56d70d4-0fbb-44da-8f3b-6ce6087ccf9b/services/3c16649d-2bb2-4531-abb0-09d4bd1a927c/partitions/192defda-7d84-4fba-b645-a2632c45d63c/replicas/132463302254650749s/, RequestStats: Please see CosmosDiagnostics, SDK: Windows/10.0.14393 cosmos-netstandard-sdk/3.3.2);););););.
MongoDB.Driver.MongoCommandException: Command aggregate failed: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4; Reason: (Message: {"Errors":["The index path corresponding to the specified order-by item is excluded."]}**
ActivityId: 87a43de8-654b-4acb-9b41-80d5c01291b4, Request URI: /apps/c56d70d4-0fbb-44da-8f3b-6ce6087ccf9b/services/3c16649d-2bb2-4531-abb0-09d4bd1a927c/partitions/192defda-7d84-4fba-b645-a2632c45d63c/replicas/132463302254650749s/, RequestStats: Please see CosmosDiagnostics, SDK: Windows/10.0.14393 cosmos-netstandard-sdk/3.3.2);););););.
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage) at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol
1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol1 protocol, ICoreSession session, CancellationToken cancellationToken) at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.ExecuteAsync[TResult](IRetryableReadOperation
1 operation, RetryableReadContext context, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.ReadCommandOperation1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken) at MongoDB.Driver.Core.Operations.AggregateOperation
1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.AggregateOperation1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken) at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation
1 operation, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation
1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.AggregateAsync[TResult](IClientSessionHandle session, PipelineDefinition
2 pipeline, AggregateOptions options, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSessionAsync[TResult](Func
2 funcAsync, CancellationToken cancellationToken)
at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListAsync[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
at Volo.Abp.Identity.MongoDB.MongoIdentityUserRepository.GetListAsync(String sorting, Int32 maxResultCount, Int32 skipCount, String filter, Boolean includeDetails, CancellationToken cancellationToken)
Steps to reproduce the issue: We have Host the Application on Azure and for database we have used Azure Cosmos Db with MongoDB API Version 3.6 application launch successfully but after login its not showing in LIST DATA for Users, Tenants everything wherever we used GetListAsync Method all got failed due to above exception. We also referred this link https://docs.microsoft.com/nl-nl/azure/cosmos-db/mongodb-troubleshoot but dont know how to solve this in ABPIO. this is our sample CosmosDB Connection String(its dummy for showing purpose) : "Default": "mongodb://ops-ai:ASDFeeZbaeQJMmhGujdWD6ZofiiChCmlR1TYHUkdp89QIAifHYTG8RaRsBthxpZ85mj8tWA9n6T8RuEIBeX4a45==@demo.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@demo@",
Any solution on High Priority will help us to move forward.
2020-10-01 05:26:47.365 +00:00 [INF] Request finished in 26.9814ms 302 text/html; charset=utf-8
2020-10-01 05:27:31.955 +00:00 [INF] Request starting HTTP/2.0 POST https://localhost:44393/signin-oidc application/x-www-form-urlencoded 1655
2020-10-01 05:27:32.274 +00:00 [INF] AuthenticationScheme: Identity.External signed in.
2020-10-01 05:27:32.275 +00:00 [INF] Request finished in 320.3263ms 302
2020-10-01 05:27:32.280 +00:00 [INF] Request starting HTTP/2.0 GET https://localhost:44393/?handler=Login
2020-10-01 05:27:32.284 +00:00 [INF] Executing endpoint '/Index'
2020-10-01 05:27:32.286 +00:00 [INF] Route matched with {page = "/Index", action = "", controller = "", area = ""}. Executing page /Index
2020-10-01 05:27:32.286 +00:00 [INF] Executing handler method ****.Web.Pages.IndexModel.OnGet - ModelState is "Valid"
2020-10-01 05:27:32.286 +00:00 [INF] Executed handler method OnGet, returned result .
2020-10-01 05:27:32.286 +00:00 [INF] Executing an implicit handler method - ModelState is "Valid"
2020-10-01 05:27:32.286 +00:00 [INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
2020-10-01 05:27:32.300 +00:00 [DBG] Added bundle 'Lepton.Global' to the page in 1.81 ms.
2020-10-01 05:27:32.303 +00:00 [INF] Authorization failed.
2020-10-01 05:27:32.305 +00:00 [INF] Authorization failed.
2020-10-01 05:27:32.311 +00:00 [DBG] Added bundle 'Lepton.Global' to the page in 4.30 ms.
2020-10-01 05:27:32.312 +00:00 [INF] Executed page /Index in 26.7772ms
2020-10-01 05:27:32.312 +00:00 [INF] Executed endpoint '/Index'
2020-10-01 05:27:32.313 +00:00 [INF] Request finished in 33.0781ms 200 text/html; charset=utf-8
2020-10-01 05:27:32.427 +00:00 [INF] Request starting HTTP/2.0 GET https://localhost:44393/Abp/ApplicationConfigurationScript
2020-10-01 05:27:32.429 +00:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc)'
2020-10-01 05:27:32.430 +00:00 [INF] Route matched with {area = "Abp", action = "Get", controller = "AbpApplicationConfigurationScript", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] Get() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController (Volo.Abp.AspNetCore.Mvc).
2020-10-01 05:27:32.431 +00:00 [DBG] Executing AbpApplicationConfigurationAppService.GetAsync()...
2020-10-01 05:27:32.433 +00:00 [INF] Request starting HTTP/2.0 GET https://localhost:44393/Abp/ServiceProxyScript
2020-10-01 05:27:32.435 +00:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc)'
2020-10-01 05:27:32.436 +00:00 [INF] Route matched with {area = "Abp", action = "GetAll", controller = "AbpServiceProxyScript", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult GetAll(Volo.Abp.AspNetCore.Mvc.ProxyScripting.ServiceProxyGenerationModel) on controller Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController (Volo.Abp.AspNetCore.Mvc).
2020-10-01 05:27:32.438 +00:00 [INF] Executing ContentResult with HTTP Response ContentType of application/javascript
2020-10-01 05:27:32.469 +00:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc) in 33.2521ms
2020-10-01 05:27:32.470 +00:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc)'
2020-10-01 05:27:32.470 +00:00 [INF] Request finished in 37.4282ms 200 application/javascript
2020-10-01 05:27:32.477 +00:00 [INF] Authorization failed.
Redirect to IdentityServer and Enter Credentials:
Not Redirecting to Dashboard and User id not loaded, Returned back to login page