路由URL不能以'/'或'〜'字符开始,它不能包含“?”字符 [英] The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character

查看:1318
本文介绍了路由URL不能以'/'或'〜'字符开始,它不能包含“?”字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个路由的路由我得到的配置错误的吸引力:

I get attractive error in routing this my routing config:

routes.MapRoute(
        name: "ChatService",
        url: "/Chat"

我得到这个错误

The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.
Parameter name: routeUrl

我的 URL:/聊天剂量没有任何'?符号。
为什么我得到这个错误?

My url: "/Chat" dose not any '?' symbol. why i get this error?

推荐答案

请阅读你仔细收到错误消息(我加粗的重要组成部分):

Please read the error message you are getting carefully (I have bolded the important part):

路线网址不能以/或'〜'字符开始,它不能包含?字符

The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character

现在看看你的路线报名再次:

Now look at your route registration once again:

routes.MapRoute(
    name: "ChatService",
    url: "/Chat"

请参阅您的URL开头的 / 人物?

See the / character that your url starts with?

好了,现在解决这个问题:

Alright, now fix it:

routes.MapRoute(
    name: "ChatService",
    url: "Chat"

这篇关于路由URL不能以'/'或'〜'字符开始,它不能包含“?”字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆