Activities of "LiSong"

Answer

just sent you an email with the project thanks

Answer

I have set up the breakpoints, and I confirm

the Type of _distributedLock is MedallionAbpDistributedLock.

the IDistributedLockProvider is RedisDistributedSynchronizationProvider

but the lock still doesnt work

Answer

thanks I am checking

Question

I need to use locking

I wrote a function and then called it three time in order to test it

cs
public async Task<IActionResult> InsertFormAnswerJson(Guid id, [FromBody] JsonElement json)
{
    var key = $"test-{id}";
    await _submissionLockCache.GetOrAddAsync(key, async () =>
    {
        // Simulate some processing
        await Task.Delay(100);
        return "test-value";
    }, () => new DistributedCacheEntryOptions
    {
        AbsoluteExpiration = Constants.RedisConstants.CacheExpiration
    });
   var value = await _submissionLockCache.GetAsync(key);
    var jsonString = json.GetRawText();
    var currentUserId = _currentUser.Id;

    if (currentUserId == null)
    {
        return Unauthorized();
    }

    var lockKey = $"form-submission-lock:{currentUserId}:{id}";

    await using var handle =
        await _distributedLock.TryAcquireAsync(lockKey,TimeSpan.FromSeconds(1));
    if (handle != null)
    {
        try
        {
            _logger.LogInformation($"form-submission:{currentUserId}:{id}");
            await _resultAnswerService.SaveUserAnswerAsync(id, currentUserId.Value, jsonString);
            return Ok();
        }
        catch (Exception ex)
        {
            return StatusCode(500, "An error occurred while processing your submission.");
        }

    }
    _logger.LogInformation($"form-submission[duplicate]:{currentUserId}:{id}");
    return StatusCode(429, "Duplicate submission detected. Please wait a moment before retrying.");
}

the locking didnt work
I have a line on the top _submissionLockCache.GetOrAddAsync to test the redis, so the redis is working properly , and the lock timeout should be just 1 sec.

2025-07-17 14:15:09.180 -07:00 [Information] Route matched with "{action = \"InsertFormAnswerJson\", controller = \"DataConnectionForm\", area = \"\", page = \"\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] InsertFormAnswerJson(System.Guid, System.Text.Json.JsonElement)" on controller "Tapp.Module.DataHub.Web.Controllers.DataConnections.DataConnectionFormController" ("Tapp.Module.DataHub.Web").
2025-07-17 14:15:25.215 -07:00 [Information] form-submission:fcc9c058-7590-4b02-f5a6-3a190bb27c6b:4ef0a401-5951-82b7-3d90-3a1adefa39ec
2025-07-17 14:15:26.529 -07:00 [Information] Start processing HTTP request "GET" "https://localhost:44381/health-status"
2025-07-17 14:15:26.529 -07:00 [Information] Sending HTTP request "GET" "https://localhost:44381/health-status"
2025-07-17 14:15:26.529 -07:00 [Information] Request starting "HTTP/1.1" "GET" "https"://"localhost:44381""""/health-status""" - null null
2025-07-17 14:15:26.532 -07:00 [Information] Executing endpoint '"Health checks"'
2025-07-17 14:15:26.711 -07:00 [Information] Executing StatusCodeResult, setting HTTP status code 200
2025-07-17 14:15:26.711 -07:00 [Information] Executed action "Tapp.Module.DataHub.Web.Controllers.DataConnections.DataConnectionFormController.InsertFormAnswerJson (Tapp.Module.DataHub.Web)" in 17530.5898ms
2025-07-17 14:15:26.711 -07:00 [Information] Executed endpoint '"Tapp.Module.DataHub.Web.Controllers.DataConnections.DataConnectionFormController.InsertFormAnswerJson (Tapp.Module.DataHub.Web)"'
2025-07-17 14:15:27.027 -07:00 [Information] Request finished "HTTP/2" "POST" "https"://"localhost:44381""""/api/data-connections/forms/4ef0a401-5951-82b7-3d90-3a1adefa39ec/answers""" - 200 null null 18225.3835ms
2025-07-17 14:15:27.213 -07:00 [Information] form-submission:fcc9c058-7590-4b02-f5a6-3a190bb27c6b:4ef0a401-5951-82b7-3d90-3a1adefa39ec
2025-07-17 14:15:27.388 -07:00 [Information] Executing StatusCodeResult, setting HTTP status code 200
2025-07-17 14:15:27.388 -07:00 [Information] Executed action "Tapp.Module.DataHub.Web.Controllers.DataConnections.DataConnectionFormController.InsertFormAnswerJson (Tapp.Module.DataHub.Web)" in 18207.493ms
2025-07-17 14:15:27.388 -07:00 [Information] Executed endpoint '"Tapp.Module.DataHub.Web.Controllers.DataConnections.DataConnectionFormController.InsertFormAnswerJson (Tapp.Module.DataHub.Web)"'
2025-07-17 14:15:27.536 -07:00 [Information] form-submission:fcc9c058-7590-4b02-f5a6-3a190bb27c6b:4ef0a401-5951-82b7-3d90-3a1adefa39ec
2025-07-17 14:15:27.625 -07:00 [Information] Request finished "HTTP/2" "POST" "https"://"localhost:44381""""/api/data-connections/forms/4ef0a401-5951-82b7-3d90-3a1adefa39ec/answers""" - 200 null null 18823.4763ms
2025-07-17 14:15:27.635 -07:00 [Information] Request starting "HTTP/2" "GET" "https"://"localhost:44381""""/""?dataconnection=4ef0a401-5951-82b7-3d90-3a1adefa39ec" - null null
2025-07-17 14:15:27.655 -07:00 [Information] Executing endpoint '"/Index"'

how can I fix it?

I read this doc https://abp.io/docs/9.2/framework//infrastructure/distributed-locking

Question

I want to set up CI/CD with GitHub Actions to deploy your Web and public.web apps to Azure App Services, I am currently using VS publish.

and I had an old one set up before and I found some errors:

un dotnet build src/Tapp.Web/Tapp.Web.csproj --configuration Release Determining projects to restore... D:\a\tapp-9\tapp-9\src\Tapp.Domain\Tapp.Domain.csproj : warning NU1504: Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: Volo.Saas.Domain 9.1.0, Volo.Saas.Domain 9.1.0. D:\a\tapp-9\tapp-9\src\Tapp.HttpApi\Tapp.HttpApi.csproj : error NU1101: Unable to find package Volo.Abp.Identity.Pro.HttpApi. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commerc ..... following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.Abp.LanguageManagement.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.FileManagement.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.Saas.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.Abp.TextTemplateManagement.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.Abp.Gdpr.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. D:\a\tapp-9\tapp-9\src\Tapp.Web\Tapp.Web.csproj : error NU1101: Unable to find package Volo.CmsKit.Pro.Domain.Shared. No packages exist with this id in source(s): nuget.org. PackageSourceMapping is enabled, the following source(s) were not considered: ABP Commercial NuGet Source, Microsoft Visual Studio Offline Packages. 2 Warning(s) 529 Error(s)

the host admin has a feature to login with a tenant admin and then switch back to the original account

I need to create a new page with the same feature, that is the host admin can see some of the tenant admin accounts, and clicking one of them will lead to the tenant site as the admin; and then on the homepage, I want to add a button says back to host site.

how can I implement it by calling the existing abp framework functions?

Answer

ok. thx

Answer

I don't see the code in the whole solution, I've actually searched for 'ConfigureCors' in the entire solution but found 0 matches, do I need to add the configurecors function myself? I want to clarify this to make sure I don't override anything underlying that might compromise security. thanks

Answer

sorry, I am using a layered application and non-Tiered, I was confused by layered and tiered. do you mind also checking the layered application for me. thanks

Answer

yes, it's a CORS error, I ran this command: curl -i -X OPTIONS https://localhost:44381/api/app/ethnicities -H 'Origin: http://localhost:5173' -H 'Access-Control-Request-Method: GET'

and got C:\Users\songh>curl -i -X OPTIONS https://localhost:44381/api/app/ethnicities -H "Origin: http://localhost:5173" -H "Access-Control-Request-Method: GET" HTTP/1.1 405 Method Not Allowed Transfer-Encoding: chunked Allow: GET, HEAD, POST Server: Microsoft-IIS/10.0 X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN X-Correlation-Id: 3880f62679854d47a73e1b5cff09a43c X-SourceFiles: =?UTF-8?B?RDpcZ2l0XHRhcHAtOVxzcmNcVGFwcC5XZWJcYXBpXGFwcFxldGhuaWNpdGllcw==?= Date: Tue, 08 Apr 2025 23:14:45 GMT

Showing 31 to 40 of 117 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 10, 2025, 12:02
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.