- Template: microservice
- Created ABP Studio Version: 1.3.2
- Current ABP Studio Version: 1.4.2
- Multi-Tenancy: Yes
- UI Framework: mvc
- Theme: leptonx
- Theme Style: system
- Theme Menu Placement: side
- Run Install Libs: Yes
- Database Provider: ef
- Database Management System: postgresql
- Mobile Framework: react-native
- Public Website: Yes
- Social Login: Yes
- Include Tests: Yes
- Dynamic Localization: Yes
- Kubernetes Configuration: Yes
- Grafana Dashboard: Yes
- Use Local References: No
- Aspire: Yes
- Optional Modules:
- GDPR
- FileManagement
- TextTemplateManagement
- AuditLogging
- Chat
- OpenIddictAdmin
- Selected Languages: English, Arabic, Chinese (Simplified), Chinese (Traditional), Czech, English (United Kingdom), Finnish, French, German (Germany), Hindi , Hungarian, Icelandic, Italian, Portuguese (Brazil), Romanian (Romania), Russian, Slovak, Spanish, Swedish, Turkish
- Default Language: English
- Create Command: abp new TavTechnologies.Treva -t microservice --ui-framework mvc --mobile react-native --database-provider ef --database-management-system postgresql --theme leptonx --skip-migrator --public-website --dont-run-bundling -no-language-management -chat -file-management
Hello Dear Abp Family,
We have an issue when we try to run web(backofficeweb) application after adding DocsAdminWebModule and DocsAdminHttpApiClientModule.
Our web application crashing on line: app.UseConfiguredEndpoints(endpoints => { endpoints.MapMetrics(); });
It's giving below error: "Volo.Docs.Admin.DocumentPdfAdminClientProxy.GeneratePdfAsync (Volo.Docs.Admin.HttpApi.Client)' has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer"
and then stopping application.
Can you help us, please?
4 Answer(s)
-
0
- Solution The exception means an endpoint discovered by ApiExplorer (OpenAPI/Swagger) is coming from a conventionally-routed action. In your case, it’s the generated client proxy for Volo.Docs Admin (DocumentPdfAdminClientProxy.GeneratePdfAsync). This happens when MVC’s conventional controller discovery and the client proxy (which ApiExplorer thinks is an API surface) are both in the pipeline without proper attribute routing metadata.
Apply one of the following fixes (prefer the first):
- Fix A: Exclude client proxy types from ApiExplorer Add an MVC option to ignore ApiExplorer for the Docs Admin HttpApi Client assembly types.
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Volo.Docs.Admin.HttpApi.Client; // for assembly reference public override void ConfigureServices(ServiceConfigurationContext context) { // ... your existing registrations Configure<MvcOptions>(options => { options.Conventions.Add(new ApiExplorerVisibilityConvention(type => type.Assembly == typeof(DocsAdminHttpApiClientModule).Assembly, isVisible: false)); }); } // helper convention public sealed class ApiExplorerVisibilityConvention : Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelConvention { private readonly Func<Type, bool> _typePredicate; private readonly bool _isVisible; public ApiExplorerVisibilityConvention(Func<Type, bool> typePredicate, bool isVisible) { _typePredicate = typePredicate; _isVisible = isVisible; } public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel application) { foreach (var controller in application.Controllers) { if (_typePredicate(controller.ControllerType.AsType())) { controller.ApiExplorer.IsVisible = _isVisible; } } } }Explanation: The Docs HttpApi Client assembly contains typed client proxies (used by your Web app to call the Docs service). They are not real MVC API controllers and shouldn’t participate in ApiExplorer/endpoint discovery. This convention hides them from ApiExplorer to prevent the “ApiExplorer enabled + conventional routing” conflict.
- Fix B: Disable ApiExplorer at controller/action level (if you have access) If a specific generated/proxy controller is being picked up, you can add:
[ApiExplorerSettings(IgnoresApi = true)]on the controller or action. However, for generated client proxies, Fix A is more robust.
Fix C: Ensure all discovered controllers use attribute routing (not recommended here) Converting affected controllers to attribute routing resolves the mismatch, but since the offending type is a client proxy (not meant to expose HTTP endpoints), hiding it from ApiExplorer is the correct approach.
About MapMetrics and UseConfiguredEndpoints The crash occurs when endpoints are finalized (app.UseConfiguredEndpoints), where MVC builds its action descriptors. The above fix prevents the proxy from being treated as an MVC action, so MapMetrics and endpoint configuration can proceed normally.
- Sources
- https://docs.abp.io/en/commercial/latest/modules/docs
- https://github.com/abpframework/abp
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
hi
We will check and fix it.
Thanks.
-
0
Hi Ma,
Thank you for your help, i fixed it with solution A.
Best regards,
Ahmet
-
0
https://github.com/abpframework/abp/pull/24094
Great