could you please provide your approach used to connect SignalR hub from Angular (Code Sample). Will try that and let you know. Still if same error comes will create sample project and send it to you.
2022-12-07 18:35:36.860 +05:30 [INF] Executed endpoint '/signalr-hubs/notification' 2022-12-07 18:35:36.862 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418246837 text/plain;charset=UTF-8 - - 200 0 text/plain 90016.7631ms 2022-12-07 18:35:36.874 +05:30 [INF] Request starting HTTP/2 OPTIONS https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418336868 - - 2022-12-07 18:35:36.874 +05:30 [INF] CORS policy execution successful. 2022-12-07 18:35:36.874 +05:30 [INF] Request finished HTTP/2 OPTIONS https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418336868 - - - 204 - - 0.6637ms 2022-12-07 18:35:36.876 +05:30 [INF] Request starting HTTP/2 GET https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418336868 text/plain;charset=UTF-8 - 2022-12-07 18:35:36.876 +05:30 [INF] CORS policy execution successful. 2022-12-07 18:35:36.882 +05:30 [INF] Executing endpoint '/signalr-hubs/notification' 2022-12-07 18:35:45.711 +05:30 [DBG] Server vmuser6:9524:a748d9e2 heartbeat successfully sent 2022-12-07 18:36:15.712 +05:30 [DBG] Aggregating records in 'Counter' table... 2022-12-07 18:36:15.715 +05:30 [DBG] Server vmuser6:9524:a748d9e2 heartbeat successfully sent 2022-12-07 18:36:45.724 +05:30 [DBG] Server vmuser6:9524:a748d9e2 heartbeat successfully sent 2022-12-07 18:37:06.901 +05:30 [INF] Executed endpoint '/signalr-hubs/notification' 2022-12-07 18:37:06.901 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418336868 text/plain;charset=UTF-8 - - 200 0 text/plain 90024.6143ms 2022-12-07 18:37:06.913 +05:30 [INF] Request starting HTTP/2 OPTIONS https://localhost:44389/signalr-hubs/notification?id=P9g94so3lFjrr4rfgjcB8A&=1670418426907 - - 2022-12-07 18:37:06.914 +05:30 [INF] CORS policy execution successful.
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;
}
};
});
hi
Steps and code to reproduce?
Steps to reproduce; Commercial Microservice Version : 5.0.1
Open any Test case from Efcore Test project
On any Method like GetlistAsync try to debug.
Put a breakpoint in CreateDatabaseAndGetConnection()
Also breakpoint in EfcoreModule as shown in Screenshot. (Here is it throwing an exception)
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.
Hello, We are using Commercial Microservice Template, and in that just added new service everything as per this documentation https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice and in that we have added Hangfire.as per this documentation https://docs.abp.io/en/abp/latest/Background-Jobs-Hangfire without adding dashboard authorization its working but not with Authorization.
Thanks for your reply. Its a new service added in Microservice template of services folder to handle background jobs so each tenant there will be separate database. hence please check according to it.
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.
Hello,
Is it possible for you to share the response of
/api/abp/api-definition?includeTypes=true
?
Not possilble, But for now could you tell us what values should be passed to generate proxy for ProductService. (We have another service like ProductService)
D:\TEST Service\TEST\apps\angular>abp generate-proxy -p [12:51:23 INF] ABP CLI (https://abp.io) [12:51:23 INF] Version 4.4.2 (Stable) [12:51:26 WRN] ABP CLI has a newer stable version 4.4.3, please update to get the latest features and fixes. [12:51:26 WRN] [12:51:26 WRN] Update Command: [12:51:26 WRN] dotnet tool update -g Volo.Abp.Cli [12:51:26 WRN] [12:51:26 WRN] 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. ? Please enter backend module name. (default: "app") " " ? Please enter backend api name, a.k.a. remoteServiceName. (default: "default") " " ? Please enter source Angular project for API definition URL & root namespace resolution. (default: workspace "defaultProject") " " ? Please enter target Angular project to place the generated code. (default: workspace "defaultProject") " "
[Project Not Found] Either define a default project in your workspace or specify the project name in schematics options.
@bunyamin We got above error, could you please tell us what exactly needs to be specify in double quotes. in last 2 questions we cant decide what needs to be passed! https://docs.abp.io/en/abp/latest/CLI#generate-proxy