Home Articles Details

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


Question: How do you resolve the error that says "#RoutePatternException: The route template separator character '/' cannot appear consecutively. It must be separated by either a #parameter or a literal value."?


Login to See the Rest of the Answer

Answer: This error shows you that there is or are invalid charecters in the #API #Route Directive. Take a look in the All the #Controllers and find where you have defined the #code below:

        [HttpGet]
        [Route("https://api.domainName.net/API/MyFunc")]//This is Wrong
        public async Task<IActionResult> MyFunc()
        {
          //ToDo
        }

When you find where the Route id invalid, correct it to the code below:

         [HttpGet]
        [Route("API/MyFunc")]//This is Correct
        public async Task<IActionResult> MyFunc()
        {
          //ToDo
        }


I hope this helps you, take care now!


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2023 - ErnesTech LLC- Privacy