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:
I developed a new project in Abp and ran it on our test servers. However, when I deployed it to production environments, I started encountering this error. I have checked all the URLs related to OpenIdDict, but couldn't find any issues. Why do you think I am getting this error? (I have checked the DNS, and there doesn't seem to be a problem there either)
2023-08-25 11:42:44.908 +03:00 [ERR] Connection id "0HMT58T053R06", Request id "0HMT58T053R06:00000001": An unhandled exception was thrown by the application.
System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString, UriKind uriKind)
at OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers.ResolveRequestUri.HandleAsync(ProcessRequestContext context)
at OpenIddict.Validation.OpenIddictValidationDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Validation.OpenIddictValidationDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandler.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
I am debugging the code below. When I check the database after executing the CompleteAsync()
command, I observe that there is no change. The change only occurs when the method is completed. Don't you think this is misleading?
public async Task UpdateAsync(string name)
{
List<string> myList = new() { "1", "2" };
foreach (var id in myList)
{
using (var uow = unitOfWorkManager.Begin(isTransactional: true))
{
var product = await productRepository.GetAsync(id);
product.SetName(name);
await productRepository.UpdateAsync(product);
await uow.CompleteAsync();
}
}
}
[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);
}