Current filter:
                                You should refresh the page.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Ayman,

                                To be able use our Reporting tools in projects that use Swagger, it is necessary to override the controllers used by our reporting components by your own implementations and hide these controllers from Swagger by using the ApiExplorerSettings attribute. For example, use the following code to implement custom controllers:

                                [C#]
                                using DevExpress.AspNetCore.Reporting.QueryBuilder; using DevExpress.AspNetCore.Reporting.QueryBuilder.Native.Services; using DevExpress.AspNetCore.Reporting.ReportDesigner; using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services; using DevExpress.AspNetCore.Reporting.WebDocumentViewer; using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services; [ApiExplorerSettings(IgnoreApi = true)] [Route("DXXRDV")] public class CustomWebDocumentViewerController : WebDocumentViewerController { public CustomWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : base(controllerService) { } public override Task<IActionResult> Invoke() { return base.Invoke(); } } [ApiExplorerSettings(IgnoreApi = true)] [Route("DXXQB")] public class CustomQueryBuilderController : QueryBuilderController { public CustomQueryBuilderController(IQueryBuilderMvcControllerService controllerService) : base(controllerService) { } public override Task<IActionResult> Invoke() { return base.Invoke(); } } [ApiExplorerSettings(IgnoreApi = true)] [Route("DXXRD")] public class CustomReportDesignerController : ReportDesignerController { public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) { } public override Task<IActionResult> Invoke() { return base.Invoke(); } }

                                Then, disable default controller implentations on your application's Startup class by using the following code:

                                [C#]
                                public void ConfigureServices(IServiceCollection services) { services.AddDevExpressControls(); services.AddMvc().ConfigureApplicationPartManager(x => { var parts = x.ApplicationParts; var aspNetCoreReportingAssemblyName = typeof(DevExpress.AspNetCore.Reporting.WebDocumentViewer.WebDocumentViewerController).Assembly.GetName().Name; var reportingPart = parts.FirstOrDefault(part => part.Name == aspNetCoreReportingAssemblyName); if (reportingPart != null) { parts.Remove(reportingPart); } }); ... }
                                Show all comments
                                • Jehad 08.09.2018

                                  [DevExpress Support team: This comment was cloned from T648164]
                                  after I implement the above code my API on swagger is display below error

                                  An unhandled exception occurred while processing the request.NotSupportedException: Ambiguous HTTP method for action - DevExpress.AspNetCore.Reporting.QueryBuilder.QueryBuilderController.Invoke (DevExpress.AspNetCore.Reporting.v18.1). Actions require an explicit HttpMethod binding for Swagger 2.0
                                  Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable<ApiDescription> apiDescriptions, ISchemaRegistry schemaRegistry)

                                  NotSupportedException: Ambiguous HTTP method for action - DevExpress.AspNetCore.Reporting.QueryBuilder.QueryBuilderController.Invoke (DevExpress.AspNetCore.Reporting.v18.1). Actions require an explicit HttpMethod binding for Swagger 2.0

                                  Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable<ApiDescription> apiDescriptions, ISchemaRegistry schemaRegistry)
                                  Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator+<>c__DisplayClass4_0.<GetSwagger>b__5(IGrouping<string, ApiDescription> group)
                                  System.Linq.Enumerable.ToDictionary<TSource, TKey, TElement>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
                                  Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(string documentName, string host, string basePath, String[] schemes)
                                  Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__6.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.AspNetCore.Builder.RouterMiddleware+<Invoke>d__4.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.Owin.Mapping.MapMiddleware+<Invoke>d__0.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter+<>c__DisplayClass6_0+<<AdaptWebSockets>b__0>d.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware+<Invoke>d__4.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  DevExpress.AspNetCore.Internal.BinaryStorageMiddleware+<Invoke>d__7.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  DevExpress.AspNetCore.Internal.ResourceManagerMiddleware+<Invoke>d__7.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  IdentityServer4.Hosting.IdentityServerMiddleware+<Invoke>d__3.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
                                  Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware+<Invoke>d__7.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  IdentityServer4.Hosting.BaseUrlMiddleware+<Invoke>d__3.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware+<>c__DisplayClass0_0+<<UseJwtTokenMiddleware>b__0>d.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware+<>c__DisplayClass0_0+<<UseJwtTokenMiddleware>b__0>d.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
                                  Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6.MoveNext()
                                  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
                                  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                  Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__7.MoveNext()

                                • Vasily (DevExpress Support) 08.09.2018

                                  Hi Ayman,

                                  This issue sounds very strange. We were not able to replicate this exception on our side after applying the adjustments suggested in the solution provided above. Would you please share your Startup.cs file declaration with us so that we will be able to review your application's configuration code. Alternatively, provide us with a simple working project that illustrates the issue in action. With a small example project, it is much easier for us to verify that the code that calls ours is valid, and that the way our controls are being used is recommended. This way, we can concentrate our resources on the problematic area:
                                  A request for simple example programs

                                  We are looking forward to hearing back from you.

                                • Jehad 08.10.2018

                                  I am waiting your feedback

                                • Alexey K (DevExpress) 08.10.2018

                                  Hi Ayman,
                                  As I can see from Startup.cs you have two services.AddMvc() calls that initiate opposite actions.
                                  The first one removes the ApplicationPart with reporting controllers using ConfigureApplicationPartManager(). And the second one adds controllers again using AddDefaultReportingControllers().
                                  Please try to use only one MVC configuration.

                                  Regards,
                                  Alexey

                                • Jehad 08.10.2018

                                  But in this case the report designer  does not working now ??

                                • Jehad 08.10.2018

                                  when I managed to solve the Query Builder issue and but Report Designer does not work at the moment
                                  and I change the startup.cs but the swagger now not working

                                • Andrey (DevExpress Support) 08.10.2018

                                  Hello,
                                  We need additional time to research this issue and we will update this ticket as soon as we have any news.

                                • Vasily (DevExpress Support) 08.13.2018

                                  Hi Jehad,

                                  The main idea of the approach suggested by Alexey above was to completely remove the "AddDefaultReportingControllers" call from your Startup.cs file. In case of using Swagger you should define controllers required for our Reporting components manually, as demonstrated in my solution above. So, it is not necessary to call the "AddDefaultReportingControllers" method:

                                  [C#]
                                  services.AddMvc( options => { options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute()); }) //.AddDefaultReportingControllers() //Remove this code line .ConfigureApplicationPartManager(x => { var parts = x.ApplicationParts; var aspNetCoreReportingAssemblyName = typeof(DevExpress.AspNetCore.Reporting.WebDocumentViewer.WebDocumentViewerController).Assembly.GetName().Name; var reportingPart = parts.FirstOrDefault(part => part.Name == aspNetCoreReportingAssemblyName); if (reportingPart != null) { parts.Remove(reportingPart); } });

                                  >>when I managed to solve the Query Builder issue and but Report Designer does not work at the moment
                                  Do you mean that after removing the aforementioned line the Web Report Designer control stops working? If so, would you please clarify what errors are displayed in the browser's console when you run the Web Report Designer page? Please make sure that "DXXRD" and "DXXRDV" calls are executed correctly on your web page when Web Report Designer is called. You can use the browser developer panel's Network tab to review how these URLs are called.