Activities of "maliming"

https://us05web.zoom.us/j/86335037655?pwd=Z1VjQms5cUJheVpENjI0SVlJcDJkZz09

Unfortunately I still can't reproduce the problem.

Thanks I will test it in deep.

Can other people's computers reproduce the problem?

hi

You can bind the 127.0.0.1 then use the http://localtest.me and http://t1.localtest.me

https://github.com/abpframework/abp-samples/blob/master/DomainTenantResolver/MVC/src/BookStore.Web/Program.cs#L53

HI

Does it go error randomly or every time?

If it every time please share the latest project. liming.ma@volosoft.com

hi

Can the Get method be asynchronous?

Otherwise, try AysncHelper


[HighlightedMember]
[UnitOfWork(isTransactional: false)]
public virtual BookStore.Test.Test Get()
{
    return AsyncHelper.RunSync(() => _repo.FirstAsync());
}

Yes

Please try to add MultipleActiveResultSets=true.

they seem to be the same as the examples

They are different. Please remove the scopeServer.Dispose();

public BookStore.Test.Test Get()
{
    using (var scopeServer = _scopedServiceProvider.GetService())
    {
        var res = scopeServer.Service.Get();
        //scopeServer.Dispose();
        return res;
    }
}

The connection does not support MultipleActiveResultSets.

Do you have MultipleActiveResultSets=True in your connection string?

Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. Object name: 'BookStoreDbContext'.

Code from a client. They don't have this problem, please try.

using System;
using Microsoft.Extensions.DependencyInjection;

namespace Acme.Bookstore
{
    public interface IScopedServiceProvider<TService>
    {
        ServiceScopeScope<TService> GetService();
    }

    public class ScopedServiceProvider<TService> : IScopedServiceProvider<TService>
    {
        private readonly IServiceProvider _provider;

        public ScopedServiceProvider(IServiceProvider provider)
        {
            this._provider = provider ?? throw new ArgumentNullException(nameof(provider));
        }

        public ServiceScopeScope<TService> GetService()
        {
            var scope = _provider.CreateScope();
            return new ServiceScopeScope<TService>(scope);
        }
    }

    public class ServiceScopeScope<TService> : IDisposable
    {
        private readonly IServiceScope _scope;

        public ServiceScopeScope(IServiceScope scope)
        {
            _scope = scope ?? throw new ArgumentNullException(nameof(scope));

            Service = scope.ServiceProvider.GetRequiredService<TService>();
        }

        public TService Service { get; }

        public void Dispose()
        {
            _scope.Dispose();
        }
    }
}

using Acme.Bookstore.Books;
using Acme.Bookstore.Repositories;
using Acme.Bookstore.Users;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;

namespace Acme.Bookstore.ReportingServices
{
    [ExposeServices(typeof(ReportingDataSourceServiceDecorator))]
    public class ReportingDataSourceServiceDecorator : IReportingDataSourceService, ITransientDependency
    {
        private readonly IScopedServiceProvider<ReportingDataSourceService> _scopedServiceProvider;

        public ReportingDataSourceServiceDecorator(IScopedServiceProvider<ReportingDataSourceService> scopedServiceProvider)
        {
            _scopedServiceProvider = scopedServiceProvider;
        }

        public IList<BookDto> GetAllBooks()
        {
            using (var scopeServer = _scopedServiceProvider.GetService())
            {
                return scopeServer.Service.GetAllBooks();
            }
        }
    }

    public class ReportingDataSourceService : ApplicationService, IReportingDataSourceService
    {
        private readonly IBookCustomRepository _bookRepo;

        public ReportingDataSourceService()
        {
            // We use this parameterless constructor in the Data Source Wizard only, and not for the actual instantiation of the repository object.
            throw new NotSupportedException();
        }
        public ReportingDataSourceService(IBookCustomRepository bookRepo)
        {
            _bookRepo = bookRepo;
        }

        [UnitOfWork]
        public virtual IList<BookDto> GetAllBooks()
        {
            var query = _bookRepo.GetAllBooksAsync();
            return ObjectMapper.Map<IList<Book>, IList<BookDto>>(
                query.Result.ToList()
            );
        }
    }
}

https://support.abp.io/QA/Questions/978/How-can-I-debug-in-the-source-code-of-ABP-framework https://support.abp.io/QA/Questions/2082/Where-can-I-find-a-guide-to-debugging-ABP https://github.com/abpframework/abp/issues/1039

Showing 9071 to 9080 of 12936 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.8.0-preview. Updated on November 12, 2026, 06:07
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.