Base solution for your next web application
Open Closed

Issue upgrading from v1.11.0 to v1.12.0 #1658


User avatar
0
hozkar created

Hi, im being trying to upgrade my app and i'm always getting the same issue.

My app was working with no problems in version 1.11.0 (this was the base version i start working) , so i decide to start upgrading it based on all the changes you did in your master branch. Everything was ok until I have to upgrade the abp nuget packages.

In my first atempt, i upgrade my nuget packages to abp v1.11.0, did all the fixes required and when i run my app, my application services were not injected by angular, and I'm always getting the following error:

"Unknown provider: abp.services.app.ubicacionProvider <- abp.services.app.ubicacion <- tenant.views.zonificacion.localidad.localidad"

That happened in all my pages with all my application services, but if i use one of your application services it worked Ok.

I checked my app services and they all implement IApplicationService and extends form AppServiceBase, same as yours.

I decided to continue upgrading to ABP version 0.11.0.2; made the required fixes, but the same problem continue.

Finally, I decided to start all over with a clean working branch of version 1.11.0 of my app and just upgrade the ABP nuget packages to version 0.11.0.2 and made only the requiered fixes (breaking changes), but I got the same problem that my app services are not injected.

Any Ideas?

Thanks in advance.


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

    Hi,

    Can you check your Logs.txt file for error details ? The error you mentioned is a client side error I think. There must be a server side error preventing proxy script generation.

  • User Avatar
    0
    hozkar created

    Hi!, thanks for your help.

    Looking at the logs.txt, it looks like my app services are loading propertly:

    DEBUG 2016-09-09 08:20:38,166 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.Authorization.Permissions.IPermissionAppService' with service name 'app/permission'.
    DEBUG 2016-09-09 08:20:38,167 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.Auditing.IAuditLogAppService' with service name 'app/auditLog'.
    DEBUG 2016-09-09 08:20:38,170 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Zonificacion.IZonificacionService' with service name 'app/zonificacionService'.
    DEBUG 2016-09-09 08:20:38,172 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Zonificacion.Telefonos.ITelefonosService' with service name 'app/telefonosService'.
    DEBUG 2016-09-09 08:20:38,174 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Zonificacion.Ubicacion.IUbicacionService' with service name 'app/ubicacionService'.
    DEBUG 2016-09-09 08:20:38,175 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Zonificacion.Nomenclatura.INomenclaturaLocalidadService' with service name 'app/nomenclaturaLocalidadService'.
    DEBUG 2016-09-09 08:20:38,177 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Zonificacion.Direcciones.IDireccionesService' with service name 'app/direccionesService'.
    DEBUG 2016-09-09 08:20:38,178 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Servicios.RedFunerarias.IRedFunerariasService' with service name 'app/redFunerariasService'.
    DEBUG 2016-09-09 08:20:38,180 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Servicios.Funerarias.IFunerariaService' with service name 'app/funerariaService'.
    DEBUG 2016-09-09 08:20:38,181 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Servicios.FunerariaSedes.IFunerariaSedeService' with service name 'app/funerariaSedeService'.
    DEBUG 2016-09-09 08:20:38,182 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Servicios.CriteriosCalificacion.ICriteriosCalificacionService' with service name 'app/criteriosCalificacionService'.
    DEBUG 2016-09-09 08:20:38,184 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Servicios.Convenios.IConvenioService' with service name 'app/convenioService'.
    DEBUG 2016-09-09 08:20:38,185 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Seguridad.ISeguridadService' with service name 'app/seguridadService'.
    DEBUG 2016-09-09 08:20:38,187 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Personas.IPersonasService' with service name 'app/personasService'.
    DEBUG 2016-09-09 08:20:38,189 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Personas.TiposDocumentos.ITiposDocumentosService' with service name 'app/tiposDocumentosService'.
    DEBUG 2016-09-09 08:20:38,190 [1    ] Abp.Logging.LogHelper                    - Dynamic web api controller is created for type 'Bow.BowApplication.Personas.PreferenciasPersonales.IPreferenciasPersonalesService' with service name 'app/preferenciasPersonalesService'.
    

    I decided to try if my web api is working, so I use Postman the way you explain in your documentation ([http://www.aspnetboilerplate.com/Pages/Documents/Zero/Startup-Template#authentication])) and all my app services were working; it is just my angular controllers that are unable to inject those propertly.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you check the response of GetAll request for angular service proxies. It looks like this,

  • User Avatar
    0
    hozkar created

    Hi, thank you so much.

    The response of my GetAll Contains all my services, here is an example of one service:

    (function (abp, angular) {
    
        if (!angular) {
            return;
        }
        
        var abpModule = angular.module('abp');
        
        abpModule.factory('abp.services.app.ubicacionService', [
            '$http', function ($http) {
                return new function () {
                    this.getPaises = function (httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/GetPaises',
                            method: 'POST',
                            data: JSON.stringify({})
                        }, httpParams));
                    };
                    
                    this.getDepartamentos = function (paisInput, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/GetDepartamentos',
                            method: 'POST',
                            data: JSON.stringify(paisInput)
                        }, httpParams));
                    };
                    
                    this.getLocalidades = function (departamentoInput, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/GetLocalidades',
                            method: 'POST',
                            data: JSON.stringify(departamentoInput)
                        }, httpParams));
                    };
                    
                    this.savePais = function (nuevoPais, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/SavePais',
                            method: 'POST',
                            data: JSON.stringify(nuevoPais)
                        }, httpParams));
                    };
                    
                    this.updatePais = function (paisUpdate, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/UpdatePais',
                            method: 'POST',
                            data: JSON.stringify(paisUpdate)
                        }, httpParams));
                    };
                    
                    this.deletePais = function (paisEliminar, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/DeletePais',
                            method: 'POST',
                            data: JSON.stringify(paisEliminar)
                        }, httpParams));
                    };
                    
                    this.saveDepartamento = function (nuevoDepartamento, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/SaveDepartamento',
                            method: 'POST',
                            data: JSON.stringify(nuevoDepartamento)
                        }, httpParams));
                    };
                    
                    this.updateDepartamento = function (departamentoUpdate, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/UpdateDepartamento',
                            method: 'POST',
                            data: JSON.stringify(departamentoUpdate)
                        }, httpParams));
                    };
                    
                    this.deleteDepartamento = function (departamentoEliminar, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/DeleteDepartamento',
                            method: 'POST',
                            data: JSON.stringify(departamentoEliminar)
                        }, httpParams));
                    };
                    
                    this.saveLocalidad = function (nuevaLocalidad, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/SaveLocalidad',
                            method: 'POST',
                            data: JSON.stringify(nuevaLocalidad)
                        }, httpParams));
                    };
                    
                    this.updateLocalidad = function (localidadUpdate, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/UpdateLocalidad',
                            method: 'POST',
                            data: JSON.stringify(localidadUpdate)
                        }, httpParams));
                    };
                    
                    this.deleteLocalidad = function (localidadEliminar, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/DeleteLocalidad',
                            method: 'POST',
                            data: JSON.stringify(localidadEliminar)
                        }, httpParams));
                    };
                    
                    this.getPaisIdAndDepartamentoIdByLocalidadId = function (localidad, httpParams) {
                        return $http(angular.extend({
                            url: abp.appPath + 'api/services/app/ubicacionService/GetPaisIdAndDepartamentoIdByLocalidadId',
                            method: 'POST',
                            data: JSON.stringify(localidad)
                        }, httpParams));
                    };
                    
                };
            }
        ]);
    
    
    })((abp || (abp = {})), (angular || undefined));
    

    And this is the error i'm getting in my webpage:

    Error: $injector:unpr
    Unknown Provider
    
    Unknown provider: abp.services.app.ubicacionProvider <- abp.services.app.ubicacion <- tenant.views.zonificacion.localidad.localidad
    

    I'm going to show you all my related code to this service:

    IUbicacionService

    public interface IUbicacionService : IApplicationService
        {
            GetPaisesOutput GetPaises();
             ...
    

    UbicacionService:

    public class UbicacionService : BowAppServiceBase, IUbicacionService
        {
                ...
    

    html:

    <div ng-controller="tenant.views.zonificacion.localidad.localidad as vm">
         <div class="row">
            <div class="col-md-12">
                <div class="portlet light bordered">
                 ...
    

    controller:

    (function () {
        appModule.controller('tenant.views.zonificacion.localidad.localidad',
            ['$scope', '$timeout', 'abp.services.app.ubicacion',
            function ($scope, $timeout, ubicacionService) {
                var vm = this;
    
                $scope.$on('$viewContentLoaded', function () {
                    App.initAjax();
                });
    
                ...
    

    looking at the source code, abp.ng.js looks like is related with angular injection, and this file has changed since version 1.11.0 which is the version I started my project. Maybe something there is breaking my app?

    Thanks in advance.

  • User Avatar
    0
    hozkar created

    Finally, we found the problem!

    In our controllers we inject the angular services proxies like this:

    'abp.services.app.ubicacion'

    But, after the update, the 'Service' suffix should not be removed, so the service should be called like this:

    'abp.services.app.ubicacionService'

    After that everything is working great.

    Is this a bug or should we continue working like this?

    Thanks.

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You're right. We have removed "Service" postfix clearing from app service names. We only remove "AppService" and "ApplicationService" postfixes in the latest release. Sorry for your case. Since we always use AppService postfix for application services, we did not think anyone using Service postfix. I suggest you to rename your application services to end with AppService if possible. Because "Service" postfix is generally used for Domain Services (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Domain-Services">http://www.aspnetboilerplate.com/Pages/ ... n-Services</a>) in DDD.

  • User Avatar
    0
    hozkar created

    Good day, hikalkan

    I will rename my services to AppService. It took me quite a while to realize what the issue was.

    Thanks a lot for the solution and the advise.