UriTemplate 通配符用于将 Uri 片段与 WCF WebGet 方法中的空格进行匹配
我使用 UriTemplate 通配符来匹配 WCF svc 路径后的整个 URI 字符串:
[WebGet(
UriTemplate = "feed/{*path}"
)]
但是,这只匹配到第一个空格(或“+”或“%20”),是否可以使其匹配空格?
这有效: /feed.svc/Folder
这些不起作用(仅返回第一个空格)
/feed.svc/Folder Name
/feed.svc/Folder +名称
/feed.svc/Folder%20Name
干杯
I'm using a UriTemplate wildcard to match the whole URI string after the path to a WCF svc:
[WebGet(
UriTemplate = "feed/{*path}"
)]
However this only matches up until the first space (or '+' or '%20'), is it possible to get it to match spaces?
This works:/feed.svc/Folder
These don't work (only returns up to the first space)
/feed.svc/Folder Name
/feed.svc/Folder+Name
/feed.svc/Folder%20Name
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,罪魁祸首是我制定的 IIS 重写规则:
这与空格不匹配,所以我只需将空格字符添加到正则表达式中,唉:
Tada!
OK the culprit was the IIS rewrite rules I had in place:
This was not matching spaces so I just had to add the space character to the regex, ala:
Tada!