Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoutePatternException occurs inside of ApplicationBuilderExtensions.UseSilkierQuartz method (a project with WebAssembly.Server) #146

Open
mamift opened this issue Apr 21, 2023 · 2 comments

Comments

@mamift
Copy link

mamift commented Apr 21, 2023

Hello,

I'm getting an RoutePatternException when invoking the ApplicationBuilderExtensions.UseSilkierQuartz method inside a WebAssembly.Server project.

The full exception trace is:

Microsoft.AspNetCore.Routing.RouteCreationException
  HResult=0x80131500
  Message=An error occurred while creating the route with name 'SilkierQuartz' and pattern '//{controller=Scheduler}/{action=Index}'.
  Source=Microsoft.AspNetCore.Mvc.Core
  StackTrace:
   at Microsoft.AspNetCore.Mvc.Routing.ConventionalRouteEntry..ctor(String routeName, String pattern, RouteValueDictionary defaults, IDictionary`2 constraints, RouteValueDictionary dataTokens, Int32 order, List`1 conventions)
   at Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource.AddRoute(String routeName, String pattern, RouteValueDictionary defaults, IDictionary`2 constraints, RouteValueDictionary dataTokens)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens)
   at Microsoft.AspNetCore.Builder.ApplicationBuilderExtensions.<>c__DisplayClass4_0.<UseSilkierQuartz>b__1(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
   at Microsoft.AspNetCore.Builder.ApplicationBuilderExtensions.UseSilkierQuartz(IApplicationBuilder app, Action`1 configure)
   at DmsImporter.Server.Program.<ConfigureAppAsync>d__16.MoveNext() in C:\Users\mmiftah\source\Tests\DmsImporter\DmsImporter\Server\Program.cs:line 200

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
RoutePatternException: The route template separator character '/' cannot appear consecutively. It must be separated by either a parameter or a literal value.

I think the issue is here at this line inside ApplicationBuilderExtensions.cs:

endpoints.MapControllerRoute(nameof(SilkierQuartz), $"{options.VirtualPathRoot}/{{controller=Scheduler}}/{{action=Index}}");
endpoints.MapControllerRoute($"{nameof(SilkierQuartz)}Authenticate", $"{options.VirtualPathRoot}/{{controller=Authenticate}}/{{action=Login}}");

By default options.VirtualPathRoot is always '/', so the string template is pre-prending '/' twice.

Seems to only happen when using WebAssembly.Server in the same project.

@IgorPrischepa
Copy link

IgorPrischepa commented Sep 28, 2023

I encountered the same error in an ASP.NET Core project.

SilkierQuartz Version: 5.0.356

image

@huangdongqin
Copy link

app.UseSilkierQuartz((services) => services.Options.VirtualPathRoot = "/quartz") ;
it can aviod error.but can't access the page.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants