Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Part of the WebAPI from Host project cannot access #5256


User avatar
0
trendline created

Zero version 5.5.0 The same application published via MVC project and Host project, some of WebAPI services, the same WebAPI service could access from MVC site, but cannot access from Host project.

As below logs recorded, the GetAll method of the Belonging service works fine, but the GetAll method of the Student service not response to the requester.

INFO  2018-06-18 11:23:34,860 [20   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/api/services/school/Belongings/GetAll application/json 
INFO  2018-06-18 11:23:34,913 [20   ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
INFO  2018-06-18 11:23:35,028 [19   ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {area = "school", action = "GetAll", controller = "Belongings"}. Executing action Viewtance.School.Belongings.BelongingsAppService.GetAll (Viewtance.School.Application)
INFO  2018-06-18 11:23:36,619 [20   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Viewtance.School.Belongings.BelongingsAppService.GetAll (Viewtance.School.Application) with arguments (Viewtance.School.Belongings.Dtos.GetAllBelongingsInput) - Validation state: Valid
INFO  2018-06-18 11:23:38,214 [19   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Viewtance.School.Belongings.BelongingsAppService.GetAll (Viewtance.School.Application), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 1591.8809ms.
INFO  2018-06-18 11:23:38,346 [19   ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO  2018-06-18 11:23:38,353 [19   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Viewtance.School.Belongings.BelongingsAppService.GetAll (Viewtance.School.Application) in 3322.0408ms
INFO  2018-06-18 11:23:38,361 [19   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 3497.0352ms 200 application/json; charset=utf-8
INFO  2018-06-18 11:27:13,362 [47   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/api/services/school/Students/GetAll application/json 
INFO  2018-06-18 11:27:13,366 [47   ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
INFO  2018-06-18 11:27:13,382 [47   ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {area = "school", action = "GetAll", controller = "Students"}. Executing action Viewtance.School.Students.StudentsAppService.GetAll (Viewtance.School.Application)
INFO  2018-06-18 11:27:15,019 [47   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Viewtance.School.Students.StudentsAppService.GetAll (Viewtance.School.Application) with arguments (Viewtance.School.Students.Dtos.GetAllStudentsInput) - Validation state: Valid

If insert a break point to track the code, the no response method will step out the break point, the client blocked on the no response state.

Anybody also encountered this issue?


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you share your StudentsAppService class ?

  • User Avatar
    0
    trendline created

    Yes, it generated by RAD tool, as below:

    public class StudentsAppService : SchoolAppServiceBase, IStudentsAppService
        {
            private readonly IRepository<Student, long> _studentRepository;
            private readonly IStudentsExcelExporter _studentsExcelExporter;
            private readonly IRepository<User,long> _userRepository;
            private readonly IRepository<Term,long> _termRepository;
            private readonly IRepository<Grade,long> _gradeRepository;
            private readonly IRepository<Class,long> _classRepository;
            private readonly IRepository<GetInTouchPathway,long> _getInTouchPathwayRepository;
    
            //GA module entity
            private readonly IRepository<Room, long> _roomRepository;
            private readonly IRepository<Bunk, long> _bunkRepository;
    
            public StudentsAppService(IRepository<Student, long> studentRepository,
                  IStudentsExcelExporter studentsExcelExporter ,
                  IRepository<User, long> userRepository,
                  IRepository<Term, long> termRepository,
                  IRepository<Grade, long> gradeRepository,
                  IRepository<Class, long> classRepository,
                  IRepository<GetInTouchPathway, long> getInTouchPathwayRepository,
                  IRepository<Room, long> roomRepository,
                  IRepository<Bunk, long> bunkRepository) 
              {
                _studentRepository = studentRepository;
                _studentsExcelExporter = studentsExcelExporter;
                _userRepository = userRepository;
                _termRepository = termRepository;
                _gradeRepository = gradeRepository;
                _classRepository = classRepository;
                _getInTouchPathwayRepository = getInTouchPathwayRepository;
                _roomRepository = roomRepository;
                _bunkRepository = bunkRepository;
              }
    
             public async Task<PagedResultDto<GetStudentForView>> GetAll(GetAllStudentsInput input)
             {
    
                var filteredStudents = _studentRepository.GetAll()
                            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false  || e.Name.Contains(input.Filter) || e.Surname.Contains(input.Filter) || e.PersonalName.Contains(input.Filter) || e.Number.Contains(input.Filter) || e.RegisteredResidence.Contains(input.Filter) || e.PhoneNumber.Contains(input.Filter) || e.IDNumber.Contains(input.Filter) || e.WeChat.Contains(input.Filter) || e.QQ.Contains(input.Filter) || e.FatherName.Contains(input.Filter) || e.FatherPhoneNumber.Contains(input.Filter) || e.FatherWeChat.Contains(input.Filter) || e.MotherName.Contains(input.Filter) || e.MotherPhoneNumber.Contains(input.Filter) || e.MotherWeChat.Contains(input.Filter) || e.ProfessionalCourseAppraisal.Contains(input.Filter) || e.LiteracyCourseAppraisal.Contains(input.Filter) || e.CustomAttributes.Contains(input.Filter))
                            .WhereIf(!string.IsNullOrWhiteSpace(input.NameFilter),  e => e.Name.ToLower() == input.NameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.SurnameFilter),  e => e.Surname.ToLower() == input.SurnameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.PersonalNameFilter),  e => e.PersonalName.ToLower() == input.PersonalNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.NumberFilter),  e => e.Number.ToLower() == input.NumberFilter.ToLower().Trim())
                            .WhereIf(input.Sex != null, e => e.Sex == input.Sex)
                            .WhereIf(input.MinBirthdayFilter != null, e => e.Birthday >= input.MinBirthdayFilter)
                            .WhereIf(input.MaxBirthdayFilter != null, e => e.Birthday <= input.MaxBirthdayFilter)
                            .WhereIf(!string.IsNullOrWhiteSpace(input.RegisteredResidenceFilter),  e => e.RegisteredResidence.ToLower() == input.RegisteredResidenceFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.PhoneNumberFilter),  e => e.PhoneNumber.ToLower() == input.PhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.IDNumberFilter),  e => e.IDNumber.ToLower() == input.IDNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.WeChatFilter),  e => e.WeChat.ToLower() == input.WeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.QQFilter),  e => e.QQ.ToLower() == input.QQFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherNameFilter),  e => e.FatherName.ToLower() == input.FatherNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherPhoneNumberFilter),  e => e.FatherPhoneNumber.ToLower() == input.FatherPhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherWeChatFilter),  e => e.FatherWeChat.ToLower() == input.FatherWeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherNameFilter),  e => e.MotherName.ToLower() == input.MotherNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherPhoneNumberFilter),  e => e.MotherPhoneNumber.ToLower() == input.MotherPhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherWeChatFilter),  e => e.MotherWeChat.ToLower() == input.MotherWeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.ProfessionalCourseAppraisalFilter),  e => e.ProfessionalCourseAppraisal.ToLower() == input.ProfessionalCourseAppraisalFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.LiteracyCourseAppraisalFilter),  e => e.LiteracyCourseAppraisal.ToLower() == input.LiteracyCourseAppraisalFilter.ToLower().Trim());
    
    
                var query = (from o in filteredStudents
                             join o1 in _userRepository.GetAll() on o.UserId equals o1.Id into j1
                             from s1 in j1.DefaultIfEmpty()
                             join o2 in _termRepository.GetAll() on o.TermId equals o2.Id into j2
                             from s2 in j2.DefaultIfEmpty()
                             join o3 in _gradeRepository.GetAll() on o.GradeId equals o3.Id into j3
                             from s3 in j3.DefaultIfEmpty()
                             join o4 in _classRepository.GetAll() on o.ClassId equals o4.Id into j4
                             from s4 in j4.DefaultIfEmpty()
                             join o5 in _getInTouchPathwayRepository.GetAll() on o.GetInTouchPathwayId equals o5.Id into j5
                             from s5 in j5.DefaultIfEmpty()
                             join o6 in _roomRepository.GetAll() on o.DormitoryRoomId.Value equals o6.Id into j6
                             from s6 in j6.DefaultIfEmpty()
    
                             select new GetStudentForView() { Student = ObjectMapper.Map<StudentDto>(o),
                                 UserName = s1 == null ? "" : s1.Name.ToString(),
                                 TermName = s2 == null ? "" : s2.Name.ToString(),
                                 GradeName = s3 == null ? "" : s3.Name.ToString(),
                                 ClassName = s4 == null ? "" : s4.Name.ToString(),
                                 GetInTouchPathwayName = s5 == null ? "" : s5.Name.ToString(),
                                 SexTypeName = L(string.Format("Enums.{0}.{1}", typeof(SexType).ToString().Split('.', StringSplitOptions.RemoveEmptyEntries).Last(), o.SexType.ToString())),
                                 DormitoryRoomName = s6 == null ? "" : s6.Name.ToString()
                             })
                             
                            .WhereIf(!string.IsNullOrWhiteSpace(input.UserNameFilter), e => e.UserName.ToLower() == input.UserNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.TermNameFilter), e => e.TermName.ToLower() == input.TermNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.GradeNameFilter), e => e.GradeName.ToLower() == input.GradeNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.ClassNameFilter), e => e.ClassName.ToLower() == input.ClassNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.GetInTouchPathwayNameFilter), e => e.GetInTouchPathwayName.ToLower() == input.GetInTouchPathwayNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.DormitoryRoomNameFilter), e => e.DormitoryRoomName.ToLower() == input.DormitoryRoomNameFilter.ToLower().Trim());
    
                var totalCount = await query.CountAsync();
    
                var students = await query
                    .OrderBy(input.Sorting ?? "student.id asc")
                    .PageBy(input)
                    .ToListAsync();
    
                return new PagedResultDto<GetStudentForView>(
                    totalCount,
                    students
                );
             }
             
             [AbpAuthorize(AppPermissions.Pages_Students_Edit)]
             public async Task<GetStudentForEditOutput> GetStudentForEdit(GetStudentForEditInput input)
             {
                Student student;
                student = await _studentRepository.FirstOrDefaultAsync(input.StudentId);
                if (input.UserId > 0)
                {
                    student = await _studentRepository.GetAll()
                        .Where(e => e.UserId == input.UserId).FirstOrDefaultAsync();
                                
                }
                var output = new GetStudentForEditOutput {Student = ObjectMapper.Map<CreateOrEditStudentDto>(student)};
    
                var sexTypeValues = from SexType enumValue in Enum.GetValues(typeof(SexType))
                                     select new { Value = Convert.ToInt32(enumValue), Text = L(string.Format("Enums.{0}.{1}", typeof(SexType).ToString().Split('.').Last(), enumValue.ToString())) };
    
                output.SexTypes = sexTypeValues.Select(st => new ComboboxItemDto(st.Value.ToString(), st.Text.ToString()) { IsSelected = output.Student.Sex == st.Value }).ToList();
    
                if (output.Student.UserId != null)
                {
                    var user = await _userRepository.FirstOrDefaultAsync((long)output.Student.UserId);
                    output.UserName = user.Surname.ToString() + user.Name.ToString();
                }
                if (output.Student.TermId != null)
                {
                    var term = await _termRepository.FirstOrDefaultAsync((long)output.Student.TermId);
                    output.TermName = term.Name.ToString();
                }
                if (output.Student.GradeId != null)
                {
                    var grade = await _gradeRepository.FirstOrDefaultAsync((long)output.Student.GradeId);
                    output.GradeName = grade.Name.ToString();
                }
                if (output.Student.ClassId != null)
                {
                    var theClass = await _classRepository.FirstOrDefaultAsync((long)output.Student.ClassId);
                    output.ClassName = theClass.Name.ToString();
                }
                if (output.Student.GetInTouchPathwayId != null)
                {
                    var getInTouchPathway = await _getInTouchPathwayRepository.FirstOrDefaultAsync((long)output.Student.GetInTouchPathwayId);
                    output.GetInTouchPathwayName = getInTouchPathway.Name.ToString();
                }
                if (output.Student.DormitoryRoomId != null)
                {
                    var dormitoryRoom = await _roomRepository.FirstOrDefaultAsync((long)output.Student.DormitoryRoomId);
                    output.DormitoryRoomName = dormitoryRoom.Name.ToString();
                }
                if (output.Student.BunkId != null)
                {
                    var bunk = await _bunkRepository.FirstOrDefaultAsync((long)output.Student.BunkId);
                    output.BunkName = bunk.Name.ToString();
                }
    
                return output;
             }
    
             public async Task CreateOrEdit(CreateOrEditStudentDto input)
             {
                if(input.Id == null){
                    await Create(input);
                }
                else{
                    await Update(input);
                }
             }
    
             [AbpAuthorize(AppPermissions.Pages_Students_Create)]
             private async Task Create(CreateOrEditStudentDto input)
             {
                var student = ObjectMapper.Map<Student>(input);
    
                
                if (AbpSession.TenantId != null)
                {
                    student.TenantId = (int?) AbpSession.TenantId;
                }
                student.StudentGuid = Guid.NewGuid();
    
                await _studentRepository.InsertAsync(student);
             }
    
             [AbpAuthorize(AppPermissions.Pages_Students_Edit)]
             private async Task Update(CreateOrEditStudentDto input)
             {
                var student = await _studentRepository.FirstOrDefaultAsync((long)input.Id);
                 ObjectMapper.Map(input, student);
             }
    
             [AbpAuthorize(AppPermissions.Pages_Students_Delete)]
             public async Task Delete(EntityDto<long> input)
             {
                await _studentRepository.DeleteAsync(input.Id);
             }
    
             public async Task<FileDto> GetStudentsToExcel(GetAllStudentsForExcelInput input)
             {
    
                var filteredStudents = _studentRepository.GetAll()
                            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false  || e.Name.Contains(input.Filter) || e.Surname.Contains(input.Filter) || e.PersonalName.Contains(input.Filter) || e.Number.Contains(input.Filter) || e.RegisteredResidence.Contains(input.Filter) || e.PhoneNumber.Contains(input.Filter) || e.IDNumber.Contains(input.Filter) || e.WeChat.Contains(input.Filter) || e.QQ.Contains(input.Filter) || e.FatherName.Contains(input.Filter) || e.FatherPhoneNumber.Contains(input.Filter) || e.FatherWeChat.Contains(input.Filter) || e.MotherName.Contains(input.Filter) || e.MotherPhoneNumber.Contains(input.Filter) || e.MotherWeChat.Contains(input.Filter) || e.ProfessionalCourseAppraisal.Contains(input.Filter) || e.LiteracyCourseAppraisal.Contains(input.Filter) || e.CustomAttributes.Contains(input.Filter))
                            .WhereIf(!string.IsNullOrWhiteSpace(input.StudentGuidFilter.ToString()),  e => e.StudentGuid.ToString() == input.StudentGuidFilter.ToString().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.NameFilter),  e => e.Name.ToLower() == input.NameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.SurnameFilter),  e => e.Surname.ToLower() == input.SurnameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.PersonalNameFilter),  e => e.PersonalName.ToLower() == input.PersonalNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.NumberFilter),  e => e.Number.ToLower() == input.NumberFilter.ToLower().Trim())
                            .WhereIf(input.MinSexFilter != null, e => e.Sex >= input.MinSexFilter)
                            .WhereIf(input.MaxSexFilter != null, e => e.Sex <= input.MaxSexFilter)
                            .WhereIf(input.MinBirthdayFilter != null, e => e.Birthday >= input.MinBirthdayFilter)
                            .WhereIf(input.MaxBirthdayFilter != null, e => e.Birthday <= input.MaxBirthdayFilter)
                            .WhereIf(!string.IsNullOrWhiteSpace(input.RegisteredResidenceFilter),  e => e.RegisteredResidence.ToLower() == input.RegisteredResidenceFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.PhoneNumberFilter),  e => e.PhoneNumber.ToLower() == input.PhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.IDNumberFilter),  e => e.IDNumber.ToLower() == input.IDNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.WeChatFilter),  e => e.WeChat.ToLower() == input.WeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.QQFilter),  e => e.QQ.ToLower() == input.QQFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherNameFilter),  e => e.FatherName.ToLower() == input.FatherNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherPhoneNumberFilter),  e => e.FatherPhoneNumber.ToLower() == input.FatherPhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.FatherWeChatFilter),  e => e.FatherWeChat.ToLower() == input.FatherWeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherNameFilter),  e => e.MotherName.ToLower() == input.MotherNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherPhoneNumberFilter),  e => e.MotherPhoneNumber.ToLower() == input.MotherPhoneNumberFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.MotherWeChatFilter),  e => e.MotherWeChat.ToLower() == input.MotherWeChatFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.ProfessionalCourseAppraisalFilter),  e => e.ProfessionalCourseAppraisal.ToLower() == input.ProfessionalCourseAppraisalFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.LiteracyCourseAppraisalFilter),  e => e.LiteracyCourseAppraisal.ToLower() == input.LiteracyCourseAppraisalFilter.ToLower().Trim());
    
    
                var query = (from o in filteredStudents
                             join o1 in _userRepository.GetAll() on o.UserId equals o1.Id into j1
                             from s1 in j1.DefaultIfEmpty()
                             join o2 in _termRepository.GetAll() on o.TermId equals o2.Id into j2
                             from s2 in j2.DefaultIfEmpty()
                             join o3 in _gradeRepository.GetAll() on o.GradeId equals o3.Id into j3
                             from s3 in j3.DefaultIfEmpty()
                             join o4 in _classRepository.GetAll() on o.ClassId equals o4.Id into j4
                             from s4 in j4.DefaultIfEmpty()
                             join o5 in _getInTouchPathwayRepository.GetAll() on o.GetInTouchPathwayId equals o5.Id into j5
                             from s5 in j5.DefaultIfEmpty()
                             join o6 in _roomRepository.GetAll() on o.DormitoryRoomId.Value equals o6.Id into j6
                             from s6 in j6.DefaultIfEmpty()
    
                             select new GetStudentForView() {
                                 Student = ObjectMapper.Map<StudentDto>(o),
                                 UserName = s1 == null ? "" : s1.Name.ToString(),
                                 TermName = s2 == null ? "" : s2.Name.ToString(),
                                 GradeName = s3 == null ? "" : s3.Name.ToString(),
                                 ClassName = s4 == null ? "" : s4.Name.ToString(),
                                 GetInTouchPathwayName = s5 == null ? "" : s5.Name.ToString(),
                                 SexTypeName = L(string.Format("Enums.{0}.{1}", typeof(SexType).ToString().Split('.', StringSplitOptions.RemoveEmptyEntries).Last(), o.SexType.ToString())),
                                 DormitoryRoomName = s6 == null ? "" : s6.Name.ToString()
                             })
                             
                            .WhereIf(!string.IsNullOrWhiteSpace(input.UserNameFilter), e => e.UserName.ToLower() == input.UserNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.TermNameFilter), e => e.TermName.ToLower() == input.TermNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.GradeNameFilter), e => e.GradeName.ToLower() == input.GradeNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.ClassNameFilter), e => e.ClassName.ToLower() == input.ClassNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.GetInTouchPathwayNameFilter), e => e.GetInTouchPathwayName.ToLower() == input.GetInTouchPathwayNameFilter.ToLower().Trim())
                            .WhereIf(!string.IsNullOrWhiteSpace(input.DormitoryRoomNameFilter), e => e.DormitoryRoomName.ToLower() == input.DormitoryRoomNameFilter.ToLower().Trim());
    
    
                var StudentListDtos = await query.ToListAsync();
    
                return _studentsExcelExporter.ExportToFile(StudentListDtos);
             }
    
             [AbpAuthorize(AppPermissions.Pages_Students)]
             public async Task<PagedResultDto<UserLookupTableDto>> GetAllUserForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _userRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e => (e.Surname.ToString() + e.Name.ToString()).Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var userList = await query
                    .PageBy(input)
                    .ToListAsync();
    
                var lookupTableDtoList = new List<UserLookupTableDto>();
                foreach(var user in userList){
                    lookupTableDtoList.Add(new UserLookupTableDto
                    {
                        Id = user.Id,
                        DisplayName = user.Surname + user.Name.ToString()
                    });
                }
    
                return new PagedResultDto<UserLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
    
            [AbpAuthorize(AppPermissions.Pages_Students)]
             public async Task<PagedResultDto<TermLookupTableDto>> GetAllTermForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _termRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.Name.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var termList = await query
                    .PageBy(input)
                    .ToListAsync();
    
                var lookupTableDtoList = new List<TermLookupTableDto>();
                foreach(var term in termList){
                    lookupTableDtoList.Add(new TermLookupTableDto
                    {
                        Id = term.Id,
                        DisplayName = term.Name.ToString()
                    });
                }
    
                return new PagedResultDto<TermLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
    
            [AbpAuthorize(AppPermissions.Pages_Students)]
             public async Task<PagedResultDto<GradeLookupTableDto>> GetAllGradeForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _gradeRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.Name.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var gradeList = await query
                    .PageBy(input)
                    .ToListAsync();
    
                var lookupTableDtoList = new List<GradeLookupTableDto>();
                foreach(var grade in gradeList){
                    lookupTableDtoList.Add(new GradeLookupTableDto
                    {
                        Id = grade.Id,
                        DisplayName = grade.Name.ToString()
                    });
                }
    
                return new PagedResultDto<GradeLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
    
            [AbpAuthorize(AppPermissions.Pages_Students)]
             public async Task<PagedResultDto<ClassLookupTableDto>> GetAllClassForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _classRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.Name.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var classList = await query
                    .PageBy(input)
                    .ToListAsync();
    
                var lookupTableDtoList = new List<ClassLookupTableDto>();
                foreach(var theClass in classList){
                    lookupTableDtoList.Add(new ClassLookupTableDto
                    {
                        Id = theClass.Id,
                        DisplayName = theClass.Name.ToString()
                    });
                }
    
                return new PagedResultDto<ClassLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }		 [AbpAuthorize(AppPermissions.Pages_Students)]
             public async Task<PagedResultDto<GetInTouchPathwayLookupTableDto>> GetAllGetInTouchPathwayForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _getInTouchPathwayRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.Name.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var getInTouchPathwayList = await query
                    .PageBy(input)
                    .ToListAsync();
    
                var lookupTableDtoList = new List<GetInTouchPathwayLookupTableDto>();
                foreach(var getInTouchPathway in getInTouchPathwayList){
                    lookupTableDtoList.Add(new GetInTouchPathwayLookupTableDto
                    {
                        Id = getInTouchPathway.Id,
                        DisplayName = getInTouchPathway.Name.ToString()
                    });
                }
    
                return new PagedResultDto<GetInTouchPathwayLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
        }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    @trendline that is strange.

    I couldn't understand why breakpoint doesn't hit in GetAll method. If you can't solve the problem, please send your project to <a href="mailto:[email protected]">[email protected]</a>.

  • User Avatar
    0
    trendline created

    After clean the solution and rebuild, local debug could hit the break point, but still cannot access some service via WebAPI after deployed to Server

    It is running based on ZERO v5.5 (MVC&jQuery version) on windows server 2016

  • User Avatar
    0
    alper created
    Support Team

    To understand the issue let's start with a small StudentsAppService . Repalace your StudentsAppService.cs with mine to see if there will be any problem with this lite version.

    using System;
    using System.Threading.Tasks;
    using Abp.Application.Services.Dto;
    using Abp.Authorization;
    using Abp.Domain.Repositories;
    using MyCompanyName.AbpZeroTemplate.Authorization;
    using MyCompanyName.AbpZeroTemplate.Dto;
    
    public class StudentsAppService : SchoolAppServiceBase, IStudentsAppService
    {
        private readonly IRepository<Student, long> _studentRepository;
    
    
        public StudentsAppService(IRepository<Student, long> studentRepository)
        {
            _studentRepository = studentRepository;
        }
    
        public async Task<PagedResultDto<GetStudentForView>> GetAll(GetAllStudentsInput input)
        {
            var students = await _studentRepository.GetAllListAsync();
            var totalCount = await _studentRepository.CountAsync();
    
            return new PagedResultDto<GetStudentForView>(
                totalCount,
                students
            );
        }
    
        [AbpAuthorize(AppPermissions.Pages_Students_Edit)]
        public async Task<GetStudentForEditOutput> GetStudentForEdit(GetStudentForEditInput input)
        {
            throw new NotImplementedException();
        }
    
        public async Task CreateOrEdit(CreateOrEditStudentDto input)
        {
            throw new NotImplementedException();
        }
    
        [AbpAuthorize(AppPermissions.Pages_Students_Create)]
        private async Task Create(CreateOrEditStudentDto input)
        {
            throw new NotImplementedException();
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Students_Edit)]
        private async Task Update(CreateOrEditStudentDto input)
        {
            throw new NotImplementedException();
        }
    
        [AbpAuthorize(AppPermissions.Pages_Students_Delete)]
        public async Task Delete(EntityDto<long> input)
        {
            throw new NotImplementedException();
        }
    
    
        public async Task<FileDto> GetStudentsToExcel(GetAllStudentsForExcelInput input)
        {
            throw new NotImplementedException();
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Students)]
        public async Task<PagedResultDto<UserLookupTableDto>> GetAllUserForLookupTable(GetAllForLookupTableInput input)
        {
            throw new NotImplementedException();
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Students)]
        public async Task<PagedResultDto<TermLookupTableDto>> GetAllTermForLookupTable(GetAllForLookupTableInput input)
        {
            throw new NotImplementedException();
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Students)]
        public async Task<PagedResultDto<GradeLookupTableDto>> GetAllGradeForLookupTable(GetAllForLookupTableInput input)
        {
            throw new NotImplementedException();
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Students)]
        public async Task<PagedResultDto<ClassLookupTableDto>> GetAllClassForLookupTable(GetAllForLookupTableInput input)
        {
            throw new NotImplementedException();
        }
    
        [AbpAuthorize(AppPermissions.Pages_Students)]
        public async Task<PagedResultDto<GetInTouchPathwayLookupTableDto>> GetAllGetInTouchPathwayForLookupTable(GetAllForLookupTableInput input)
        {
            throw new NotImplementedException();
        }
    
    }