Base solution for your next web application

Activities of "jumpball"

Answer

By the way, now we've got step-by-step tutorial how to cerate versioned API :)

Answer

Hi,

I've added interface IApiV1Service HbOnline.Api.V1 project RegionAppService in this project now start with public class RegionAppService : HbOnlineAppServiceBase, IRegionAppService, IApiV1Service { ...

Then one more line was added to PreInitialize in WebHostModeule IocManager.IocContainer.Register(Classes.FromAssemblyNamed(typeof(HbOnlineApiV1Module).Assembly.FullName).BasedOn<IApiV1Service>().LifestylePerThread().WithServiceSelf());

And now I's Ok I have 2 versions of API and controllers in this version can has the same names

INFO 2017-05-17 17:11:50,682 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/api/services/app/Region/GetRegions">http://localhost:22742/api/services/app ... GetRegions</a>
... INFO 2017-05-17 17:11:52,053 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action HbOnline.Regions.RegionAppService.GetRegions (HbOnline.Application) in 1364.5514ms ... INFO 2017-05-17 17:12:22,727 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/api/services/v1/Region/GetRegions">http://localhost:22742/api/services/v1/ ... GetRegions</a>
... INFO 2017-05-17 17:12:23,158 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action HbOnline.Api.V1.RegionAppService.GetRegions (HbOnline.Api.V1) in 425.9908ms

Thanks for your advices and for good ABP & AspNetZero documentation

Answer

DEBUG 2017-05-16 11:24:13,690 [10 ] NetCore.StaticFiles.StaticFileMiddleware - The request path /api/services/v1/Region/GetRegions does not match a supported file type DEBUG 2017-05-16 11:24:13,690 [10 ] osoft.AspNetCore.Routing.Tree.TreeRouter - Request successfully matched the route with name '(null)' and template 'api/services/v1/Region/GetRegions'. DEBUG 2017-05-16 11:24:13,702 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action HbOnline.HbDirectory.Regions.V1.RegionAppService.GetRegions (HbOnline.Api.V1) ERROR 2017-05-16 11:24:13,706 [10 ] Mvc.ExceptionHandling.AbpExceptionFilter - No component for supporting the service HbOnline.HbDirectory.Regions.V1.RegionAppService was found Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service HbOnline.HbDirectory.Regions.V1.RegionAppService was found в Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) в Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) в Castle.Windsor.WindsorContainer.Resolve(Type service) в Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) в Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) в Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType) в Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) в Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) в Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(ControllerContext context) в Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) в Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() DEBUG 2017-05-16 11:24:14,378 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-05-16 11:24:14,410 [10 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-05-16 11:24:14,410 [10 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-05-16 11:24:14,430 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action HbOnline.HbDirectory.Regions.V1.RegionAppService.GetRegions (HbOnline.Api.V1) in 727.8813ms DEBUG 2017-05-16 11:24:14,430 [10 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4S6JCVM439" completed keep alive response. INFO 2017-05-16 11:24:14,430 [10 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 741.8192ms 500 application/json; charset=utf-8

Answer

Hi,

Unfortunately I stopped at the last step Could you help me I'll describe what I did

  1. As described hear <a class="postlink" href="https://aspnetzero.com/Documents/Developing-Step-By-Step-Angular">https://aspnetzero.com/Documents/Develo ... ep-Angular</a> it was created entity Region, RegionListDto, IRegionAppService, RegionAppService, table Region in DB ang this table was filled by test regions Method GET /api/services/app/Region/GetRegions work good

  2. Then it was created project MyApp.Api.V1 RegionListDto, IRegionAppService, RegionAppService was moved to this project Namespase of RegionAppService changed from MyApp.Regions to MyApp.Regions.V1

  3. Added class MyAppApiV1Module : AbpModule in project MyApp.Api.V1

  4. In project HbOnline.Web.Host: 4.1 To PreInitialize of HbOnlineWebHostModule added line Configuration.Modules.AbpAspNetCore().CreateControllersForAppServices(typeof(MyAppApiV1Module).Assembly, moduleName: "v1", useConventionalHttpVerbs: true); 4.2 In Startup.cs code inside services.AddSwaggerGen added line options.SwaggerDoc("v1", new Info { Title = MyApp API v1", Version = "v1" });

    and options.DocInclusionPredicate((docName, description) => true changed to options.DocInclusionPredicate((docName, description) => { return description.GroupName == docName; }); Added services.AddMvc(c => c.Conventions.Add(new ApiExplorerGroupPerVersionConvention()) ); and inside app.UseSwaggerUI(options => line inserted options.SwaggerEndpoint("/swagger/v1/swagger.json", "MyApp API v1");

4.3 Added class public class ApiExplorerGroupPerVersionConvention : IControllerModelConvention { var controllerNamespace = controller.ControllerType.Namespace; // e.g. "Controllers.V1" var apiVersion = controllerNamespace.Split('.').Last().ToLower(); controller.ApiExplorer.GroupName = apiVersion == "v1" ? "v1" :"app"; } 5. After successefully start of server project we can see 2 version of API on swagger page Under MyApp API v1 only 1 controller and 1 GET method Region GET /api/services/v1/Region/GetRegions

But after press Try it out! I've got Response code 500 Response Body { "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "An internal error occurred while executing the request!", "details": null, "validationErrors": null }, "unAuthorizedRequest": false, "__abp": true }

Probably problem with routing: Request really sended to localhost:22742/api/services/v1/Region/GetRegions But it can not find action of controller

Other requests work exelent

What have I missed?

Answer

Hi,

I found how to do two or more api versions /api/services/app /api/services/v1 /api/services/v2 etc.

Thanks.

Answer

Thanks,

Where is this part of path defined /api/services/app

In ABP? If I want to use single version but /api/v2 How can I redefine it?

Question

Hi

Is it possible (in Angular & ASP.NET Core project) to change AppService url for next API version For example /api/v2/Person/GetAllPersons or /api/services/v2/Person/GetAllPersons

instead of /api/services/app/Person/GetAllPersons

Hi, Ismail

Now it's Ok Thank you!

I can open other modals without problem

Concole error: EXCEPTION: Uncaught (in promise): Error: Error in ./LanguageTextsComponent class LanguageTextsComponent - inline template:24:32 caused by: Unexpected token : SyntaxError: Unexpected token :

Hi, After installation project 'ASP.NET Core & Angular 2+' as described in GETTING STARTED document it started without problem

But modal windows for changing language texts do not open - no ability to change texts Also I can not see General tab on setting page to set timezone (as host admin and as tenant admin)

What's wrong?

Showing 1 to 10 of 14 entries