[15:38:28 INF] Started database migrations...
[15:38:28 INF] Migrating schema for host database...
[15:38:29 ERR] ABP-LIC-0016 - You are not granted permission to use the module 'Volo.Abp.OpenIddict.Pro.EntityFrameworkCore-v7.1.1.0'.
[15:38:37 INF] Executing host database seed...
[15:38:49 INF] Successfully completed host database migrations.
[15:38:49 INF] Successfully completed all database migrations.
[15:38:49 INF] You can safely end this process...
Actually my database has been created.Is this error a fatal error?
when the await uow.CompleteAsync();
runs I observe that there is a change in the database
public virtual async Task UpdateNameAsync(Guid id)
{
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var book = await _bookRepository.GetAsync(id);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception")
}
but when the await uow.CompleteAsync();
runs in the code below, there is no change in the database. Surrounding unit of work manages book entity (instead of new uow)
public virtual async Task UpdateNameAsync(Guid id)
{
var book = await _bookRepository.GetAsync(id);
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception")
}
My original code similar like below. I want database changes to commit even though Exception is thrown.
public virtual async Task UpdateNameAsync(Guid id)
{
var book = await _bookRepository.GetAsync(id);
await UpdateNameFunctionAsync(book);
}
private async Task UpdateNameFunctionAsync(Book book)
{
var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception");
}
Would you consider this a bug?
SQLite Error 1: 'table "SaasEditions" already exists'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.<PrepareAndEnumerateStatements>d__64.MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.<GetStatements>d__54.MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()
at MyCompany.ABC.EntityFrameworkCore.ABCEntityFrameworkCoreTestModule.CreateDatabaseAndGetConnection() in
I have two Dbcontext and run without error. But I cannot run test. and I got error : Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: 'table "SaasEditions" already exists
public class MyFirsDbContext : AbpDbContext<MyFirsDbContext>,IHasEventInbox, IHasEventOutbox, IServicePriceDbContext
//IIdentityProDbContext,
//ISaasDbContext
{
}
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
[ConnectionStringName("Second")]
public class MySecondDbContext :AbpDbContext<MySecondDbContext>, IIdentityProDbContext, ISaasDbContext
{
...
// SaaS
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
...
}
According to this link I try to add following lines in ConfigureServices
method.
public class MyClientAppModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
// Prepare for static client proxy generation
context.Services.AddStaticHttpClientProxies(
typeof(MyClientAppModule).Assembly
);
}
}
and add Project References MyApplicationService project into MyApplication.Http.Client projects
But I got compile error: Error NU1201 Project XXX.Application is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project
.Application TargetFramework : .net6.0 .Client TargetFramework : netstandard2.0
I wrote Http Patch method in an application service.To make run patch method regarding to this url I added below codes to Program.cs:
try
{
Log.Information("Starting Sample.V6.HttpApi.Host.");
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers().AddNewtonsoftJson(); // ONLY ADDED THIS LINE
builder.Host
.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<IntHttpApiHostModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
Added this nuget package : https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.NewtonsoftJson/Microsoft.AspNetCore.Mvc.NewtonsoftJson
Is these steps okay especially do adding builder.Services.AddControllers().AddNewtonsoftJson();
may cause any problem?
Note: I tested patch method and it run successfully.
ABP Framework version: v5.3.3
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
Exception message and stack trace:
Response status code does not indicate success: 404 (). System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at Volo.Abp.Cli.ServiceProxying.ServiceProxyGeneratorBase``1.GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\ServiceProxyGeneratorBase.cs:line 36
Steps to reproduce the issue:" Open a command-line terminal in the root folder of your client project:
abp generate-proxy -t csharp -u "https://demo.channelengine.net/api/swagger"
I can use generate-proxy for my abp project url successfully . But I failed when using generate-proxy command in another url . Can I use generate-proxy command for any swagger url?
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
Abp suite doesn't create UI Pages if Abp solution is a module. Is there a bug or is this impossible?
I create an entity with Abp Suite. Update method was created like this:
public async Task<<Product>> UpdateAsync(
Guid id,
string type
)
{
var queryable = await _productRepository.GetQueryableAsync();
var query = queryable.Where(x => x.Id == id);
var product = await AsyncExecuter.FirstOrDefaultAsync(query);
product.Type = type;
return await _productRepository.UpdateAsync(product);
}
Why isn't the method created like this?
public async Task<<Product>> UpdateAsync(
Guid id,
string type
)
{
var product = await _productRepository.GetAsync(id);
product.Type = type;
return await _productRepository.UpdateAsync(product);
}
Today we faced a really critical problem, all logged in user's in the system (belongs to different tenants) started to be behave like logged in via same tenant and user like XTenant\XUser to the system. Angular side was showing this same tenant and user in top of the right (profile) area. In thi situation we opened Linked Accounts and screen was like below. The problem has been solved after restarting service (app). This problem occured second time. Because of the user's belongs to different tenants see the unrelated (unauthorized) data, this problem is really critical for us. We need urgent support for this.
We are not sure if related with problem, but want to share as an extra information, we realised below error on logs approximately same time:
Invalid extension grant{"error":"TheTargetUserIsNotLinkedToYou"}, details: {"ClientId":"MyApp_App","ClientName":"MyApp_App","GrantType":"LinkLogin","Scopes":"XProject offline_access","AuthorizationCode":"********","RefreshToken":"********","UserName":null,"AuthenticationContextReferenceClasses":null,"Tenant":null,"IdP":null,"Raw":{"grant_type":"LinkLogin","LinkUserId":"39fb9b1b-1ccc-51d0-f52a-964600e6ed13","access_token":"**","client_id":"MyApp_App","client_secret":"***REDACTED***","scope":"offline_access XProject","LinkTenantId":"3a031155-0c87-72e8-5057-48a94e23fce3"},"$type":"TokenRequestValidationLog"}
Note:There are 162 rows in AbpLinkUsers table
I am getting error when submit a record on UI page ("An error occured"):
and AbpAuditLogs.exceptions :
[
{
"code": "Xproject:00132",
"message": "Exception of type 'MyCompany.Xproject.Domain.Addresses.Exceptions.TaxOfficeNotMatchException' was thrown.",
"details": "TaxOfficeNotMatchException: Exception of type 'MyCompany.Xproject.Domain.Addresses.Exceptions.TaxOfficeNotMatchException' was thrown.\nSTACK TRACE: at MyCompany.Xproject.Addresses.AddressManager.CheckTaxOfficeAsync(String taxOffice) in C:\\MyCompany\\Repos\\MyCompany.ECOM.Misc\\MyCompany.Xproject\\aspnet-core\\src\\MyCompany.Xproject.Domain\\Addresses\\AddressManager.cs:line 120\n at MyCompany.Xproject.Addresses.AddressManager.CreateAsync(Int32 countryId, Nullable`1 municipalityId, Nullable`1 neighbourhoodId, Nullable`1 parentId, Nullable`1 cityId, String salutation, String contactName, String contactSurName, String countryPhonePrefix, String phone, String eMail, String companyTitle, String companyDepartment, String iossNr, String postalCode, String addressText, String taxOffice, String taxNr, String idNr, IndividualCorporateType individualCorporateTypeId, DeliveryType deliveryTypeId, Decimal code, Nullable`1 adressTypeId, Boolean deliveryAndInvoiceAddressSame) in C:\\MyCompany\\Repos\\MyCompany.ECOM.Misc\\MyCompany.Xproject\\aspnet-core\\src\\MyCompany.Xproject.Domain\\Addresses\\AddressManager.cs:line 55\n at MyCompany.Xproject.Addresses.AddressesAppService.CreateAsync(AddressCreateDto input) in C:\\MyCompany\\Repos\\MyCompany.ECOM.Misc\\MyCompany.Xproject\\aspnet-core\\src\\MyCompany.Xproject.Application\\Addresses\\AddressAppService.cs:line 263\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\n at
but message in logs.txt looks like it should
2022-06-07 14:36:18.774 +03:00 [WRN] ---------- RemoteServiceErrorInfo ----------
{
"code": "Xproject:00132",
"message": "Vergi Dairesi Alanı Eşleşmedi",
"details": null,
"data": {},
"validationErrors": null
}
2022-06-07 14:36:18.774 +03:00 [WRN] Exception of type 'MyCompany.Xproject.Domain.Addresses.Exceptions.TaxOfficeNotMatchException' was thrown.
MyCompany.Xproject.Domain.Addresses.Exceptions.TaxOfficeNotMatchException: Exception of type 'MyCompany.Xproject.Domain.Addresses.Exceptions.TaxOfficeNotMatchException' was thrown.
at MyCompany.Xproject.Addresses.AddressManager.CheckTaxOfficeAsync(String taxOffice) in C:\MyCompany\Repos\MyCompany.ECOM.Misc\MyCompany.Xproject\aspnet-core\src\MyCompany.Xproject.Domain\Addresses\AddressManager.cs:line 120
at MyCompany.Xproject.Addresses.AddressManager.CreateAsync(Int32 countryId, Nullable`1 municipalityId, Nullable`1
I don't manage exception manually. (there is no any try-catch block)
private async Task CheckTaxOfficeAsync(string taxOffice)
{
if (!string.IsNullOrEmpty(taxOffice))
{
var address = (await _taxOfficeRepository.GetQueryableAsync()).Any(x => x.Name == taxOffice);
if (!address)
{
throw new TaxOfficeNotMatchException();
}
}
}
public class TaxOfficeNotMatchException : BusinessException
{
public TaxOfficeNotMatchException()
: base(XprojectErrorCodes.XprojectTaxOfficeNotMatchError)
{
}
}