hi
error NU1101: Unable to find package Siemens.PSSX.Users.EntityFrameworkCore. N
o packages exist with this id in source(s): ABP Commercial NuGet Source,How can I restore this package?
Sorry my bad, I forgot this one.. I replaced this one with Volo's Users package and shared it again
hi
Request did not specify a service API version, but multiple candidate actions were found.
Can you share a simple project to reproduce?
liming.ma@volosoft.com
Sent
hi
siemens.pSSX.odms.models.v130.model;
This sample also uses the ajax to get the different results
https://github.com/abpframework/abp-samples/blob/master/Api-Versioning/host/BookStore.WebApp/Pages/Index.cshtml#L9-L35
https://github.com/abpframework/abp-samples/pull/126
As far as I see, my question is not understood clearly,
The examples above are not related to https://docs.abp.io/en/abp/latest/UI/AspNetCore/Data-Tables#ajax-adapter or I cannot make connection
ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList, inputAction, responseCallback)
If there is more than one version of acme.bookStore.books.book.getList
, I encounter the following error.
Request did not specify a service API version, but multiple candidate actions were found.
acme.bookStore.books.book.getList('2.0') or similar approach doesn't help here
So what should we do here ?
Check the docs before asking a question: https://docs.abp.io/en/abp/latest/API/API-Versioning https://docs.abp.io/en/abp/7.3/UI/AspNetCore/Data-Tables
Check the samples to see the basic tasks: https://github.com/abpframework/abp-samples/tree/master/Api-Versioning [This example doesn't show how to integrate api versiong with Datatables ]
We have more than one version of one of our APIs.
We can easily see the versions through the Swagger
interface and working as intended.
JS proxy configuration from .Web
project as shown below;
(function(){
abp.utils.createNamespace(window, 'siemens.pSSX.odms.models.v130.model');
... ///
siemens.pSSX.odms.models.v130.model.getList = function(input, ajaxParams) {
var api_version = api_version ? api_version : '13.0';
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/odms/models' + abp.utils.buildQueryString([{ name: 'filterText', value: input.filterText }, { name: 'name', value: input.name }, { name: 'description', value: input.description }, { name: 'serverName', value: input.serverName }, { name: 'cIMVersion', value: input.cIMVersion }, { name: 'creatorId', value: input.creatorId }, { name: 'creationTimeMin', value: input.creationTimeMin }, { name: 'creationTimeMax', value: input.creationTimeMax }, { name: 'lastModifierId', value: input.lastModifierId }, { name: 'lastModificationTimeMin', value: input.lastModificationTimeMin }, { name: 'lastModificationTimeMax', value: input.lastModificationTimeMax }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'api-version', value: input.api_version }]) + '',
type: 'GET'
}, ajaxParams));
};
})();
(function(){
abp.utils.createNamespace(window, 'siemens.pSSX.odms.models.v131.model');
siemens.pSSX.odms.models.v131.model.getList = function(input, ajaxParams) {
var api_version = api_version ? api_version : '13.1';
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/odms/models' + abp.utils.buildQueryString([{ name: 'filterText', value: input.filterText }, { name: 'name', value: input.name }, { name: 'description', value: input.description }, { name: 'serverName', value: input.serverName }, { name: 'cIMVersion', value: input.cIMVersion }, { name: 'creatorId', value: input.creatorId }, { name: 'creationTimeMin', value: input.creationTimeMin }, { name: 'creationTimeMax', value: input.creationTimeMax }, { name: 'lastModifierId', value: input.lastModifierId }, { name: 'lastModificationTimeMin', value: input.lastModificationTimeMin }, { name: 'lastModificationTimeMax', value: input.lastModificationTimeMax }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'api-version', value: input.api_version }]) + '',
type: 'GET'
}, ajaxParams));
};
})();
For the sake of simplicity, two different MVC UI were designed for two different API versions.
var l = abp.localization.getResource("Odms");
var modelService = siemens.pSSX.odms.models.v130.model;
var getFilter = function () {
return {
filterText: $("#FilterText").val(),
name: $("#NameFilter").val(),
description: $("#DescriptionFilter").val(),
serverName: $("#ServerNameFilter").val(),
cIMVersion: $("#CIMVersionFilter").val(),
creatorId: $("#ServerNameFilter").val(),
creationTimeMin: $("#CreationTimeFilterMin").val(),
creationTimeMax: $("#CreationTimeFilterMax").val(),
lastModifierId: $("#ServerNameFilter").val(),
lastModificationTimeMin: $("#LastModificationTimeFilterMin").val(),
lastModificationTimeMax: $("#LastModificationTimeFilterMax").val(),
};
};
var dataTable = $("#ModelsTable").DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
scrollX: true,
autoWidth: false,
scrollCollapse: true,
order: [[1, "asc"]],
ajax: **abp.libs.datatables.createAjax(modelService.getList, getFilter),**
columnDefs: [
{
... ///
}
]
}));
abp.libs.datatables.createAjax(modelService.getList, getFilter),
How can we specify a service API version when creating ajax ?
Log: 2023-09-18 20:21:27.944 +02:00 [INF] Request did not specify a service API version, but multiple candidate actions were found. Candidate actions: Siemens.PSSX.Odms.Models.v130.ModelController.GetListAsync (Siemens.PSSX.Odms.HttpApi) Siemens.PSSX.Odms.Models.v131.ModelController.GetListAsync (Siemens.PSSX.Odms.HttpApi)
context.Services.AddAuthentication()
//.AddAbpOpenIdConnect("myAuthSchema", "myAuth AD", options =>
.AddOpenIdConnect("myAuthSchema", "myAuth AD", options =>
{
options.Authority = configuration["AzureAd:Authority"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".TrimEnd('/');
options.MetadataAddress = configuration["AzureAd:MetadataAddress"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".EnsureEndsWith('/') + ".well-known/openid-configuration";
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = configuration["AzureAd:ClientId"];
options.ClientSecret = configuration["AzureAd:ClientSecret"];
options.UsePkce = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
};
options.TokenValidationParameters.ValidIssuers = new[]
{
configuration["AzureAd:MetadataAddress"],
configuration["AzureAd:Authority"]
};
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("offline_access");
options.Scope.Add("email");
});
.WithDynamicOptions < OpenIdConnectOptions, OpenIdConnectHandler > (
"myAuthSchema",
options =>
{
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
}
);
I would like to provide ClientId
and ClientSecret
values via Account External Provider Settings
/api/account/external-provider endpoint keeps returning only Google, Twitter and Microsoft values
I also tried to extend provider list via AbpExternalProviderOptions
but no luck
context.Services.Configure < AbpExternalProviderOptions > (options =>
{
options.Definitions.Add(new ExternalProviderDefinition()
{
Name = "Test",
Properties = new List < ExternalProviderDefinitionProperty >()
});
});
What am i missing ?
Hello, We can load module classes as plug-ins without adding reference to project. The relevant explanation is https://docs.abp.io/en/abp/latest/PlugIn-Modules located at here.
Where should we define MyPlugInDemoWebModule class in this example?
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity.PlugIns;
namespace MyPlugInDemo.Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<MyPlugInDemoWebModule>(options =>
{
options.PlugInSources.AddFolder(@"D:\Temp\MyPlugIns");
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}
}
This sample code does not seem updated.
Can we replace ConfigureServices(IServiceCollection services) part with
public override void ConfigureServices(ServiceConfigurationContext context)
{
}
and Configure(IApplicationBuilder app) part with
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.InitializeApplication();
}
More importantly, Can you share an example where we consume a service in a project that we did add as reference
For example, I want to call MyService : IMyService, ITransientDependency that we created in the plug-in
Also sent entire log via e-mail;
AuthServer;
2023-03-16 12:53:09.035 +01:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)' 2023-03-16 12:53:09.036 +01:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync(Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions) on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc). 2023-03-16 12:53:09.063 +01:00 [INF] Executing action method Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) - Validation state: "Valid" 2023-03-16 12:53:09.065 +01:00 [DBG] Executing AbpApplicationConfigurationAppService.GetAsync()... 2023-03-16 12:53:09.096 +01:00 [DBG] Executed AbpApplicationConfigurationAppService.GetAsync(). 2023-03-16 12:53:09.097 +01:00 [INF] Executed action method Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 33.3081ms. 2023-03-16 12:53:09.097 +01:00 [DBG] Added 0 entity changes to the current audit log 2023-03-16 12:53:09.098 +01:00 [DBG] Added 0 entity changes to the current audit log 2023-03-16 12:53:09.099 +01:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'. 2023-03-16 12:53:09.101 +01:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 65.0083ms 2023-03-16 12:53:09.101 +01:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)' 2023-03-16 12:53:09.101 +01:00 [INF] Request finished HTTP/1.1 GET https://localhost:44374/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0 - - - 200 - application/json;+charset=utf-8 68.7130ms 2023-03-16 12:53:09.168 +01:00 [INF] Request starting HTTP/1.1 GET https://localhost:44374/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0 - - 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ResolveServerConfiguration. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2023-03-16 12:53:09.169 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ResolveTokenValidationParameters. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidateIdentityModelToken. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+NormalizeScopeClaims. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+MapInternalClaims. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidatePrincipal. 2023-03-16 12:53:09.170 +01:00 [INF] The authentication demand was rejected because the token was expired. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidateExpirationDate. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidateExpirationDate. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken. 2023-03-16 12:53:09.170 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken. 2023-03-16 12:53:09.170 +01:00 [INF] OpenIddict.Validation.AspNetCore was not authenticated. Failure message: An error occurred while authenticating the current request. 2023-03-16 12:53:09.170 +01:00 [INF] OpenIddict.Validation.AspNetCore was not authenticated. Failure message: An error occurred while authenticating the current request. 2023-03-16 12:53:09.171 +01:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationLocalizationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
Api Host;
2023-03-16 12:53:06.141 +01:00 [DBG] Batch acquisition of 0 triggers
2023-03-16 12:53:09.691 +01:00 [INF] Request starting HTTP/1.1 GET https://localhost:44319/api/project-planning/base-models/properties?Sorting=baseModel.name+asc&SkipCount=0&MaxResultCount=10&api-version=1.0 - -
2023-03-16 12:53:09.712 +01:00 [DBG] Acquiring a lock on 3b2efba2d4d943c6be4c79e83d238a72
2023-03-16 12:53:09.713 +01:00 [DBG] Lock acquired on 3b2efba2d4d943c6be4c79e83d238a72
2023-03-16 12:53:09.811 +01:00 [DBG] Found 0 workflows with correlation ID 3b2efba2d4d943c6be4c79e83d238a72
2023-03-16 12:53:09.811 +01:00 [DBG] Triggering workflows using HttpEndpoint
2023-03-16 12:53:09.860 +01:00 [INF] Failed to validate the token.
Microsoft.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired. ValidTo: '3/16/2023 10:33:46 AM', Current time: '3/16/2023 11:53:09 AM'.
at Microsoft.IdentityModel.Tokens.Validators.ValidateLifetime(Nullable1 notBefore, Nullable
1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateLifetime(Nullable1 notBefore, Nullable
1 expires, JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateJWS(String token, TokenValidationParameters validationParameters, BaseConfiguration currentConfiguration, SecurityToken& signatureValidatedToken, ExceptionDispatchInfo& exceptionThrown)
--- End of stack trace from previous location ---
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, JwtSecurityToken outerToken, TokenValidationParameters validationParameters, SecurityToken& signatureValidatedToken)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
2023-03-16 12:53:09.864 +01:00 [INF] Bearer was not authenticated. Failure message: IDX10223: Lifetime validation failed. The token is expired. ValidTo: '3/16/2023 10:33:46 AM', Current time: '3/16/2023 11:53:09 AM'.
2023-03-16 12:53:09.919 +01:00 [INF] Executing endpoint 'Siemens.PSSX.ProjectPlanning.BaseModels.v1.BaseModelController.GetListWithNavigationPropertiesAsync (Siemens.PSSX.ProjectPlanning.HttpApi)'
2023-03-16 12:53:09.922 +01:00 [INF] Route matched with {controller = "Base Models", action = "GetListWithNavigationProperties", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto
1[Siemens.PSSX.ProjectPlanning.BaseModels.v1.Dtos.BaseModelWithNavigationPropertiesDto]] GetListWithNavigationPropertiesAsync(Siemens.PSSX.ProjectPlanning.BaseModels.v1.Dtos.GetBaseModelWithNavigationPropertiesInput) on controller Siemens.PSSX.ProjectPlanning.BaseModels.v1.BaseModelController (Siemens.PSSX.ProjectPlanning.HttpApi).
2023-03-16 12:53:10.006 +01:00 [INF] Executing action method Siemens.PSSX.ProjectPlanning.BaseModels.v1.BaseModelController.GetListWithNavigationPropertiesAsync (Siemens.PSSX.ProjectPlanning.HttpApi) - Validation state: "Valid"
2023-03-16 12:53:10.027 +01:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: ProjectPlanning.BaseModel
2023-03-16 12:53:10.166 +01:00 [WRN] ---------- RemoteServiceErrorInfo ----------
{
"code": "Volo.Authorization:010001",
"message": "Authorization failed! Given policy has not granted.",
"details": null,
"data": {},
"validationErrors": null
}
private static ApplicationMenuItem AddModuleMenuItem(MenuConfigurationContext context)
{
var l = context.GetLocalizer<TestModuleResource>();
var moduleMenu = new ApplicationMenuItem(
TestModuleMenus.Prefix,
displayName: l["Menu:TestModule"],
"~/TestModule",
icon: "fa fa-globe");
//Add main menu items.
context.Menu.Items.AddIfNotContains(moduleMenu);
return moduleMenu;
}
I believe that it is related with virtual file configuration of the Web.Host template File path needs to be Domain.Shared not Domain