使用 '。'在 Web Api 中使用属性路由给出 404 错误

Using '.' in Web Api using Attribute Routing is giving 404 error

我正在使用路由属性尝试通过 url 将字符串发送到我的网站 Api。 我有一个定义为

的路线
[Route("Search/{searchText}")]

我需要一个字符串值作为 searchText。它似乎工作正常,但如果有“。”,我会收到错误消息。在我的参数中。 对于前。

http://localhost/api/Person/Search/me is working fine, 

但是

http://localhost/api/Person/Search/me.me

我的浏览器出现 404 错误。

'.'字符 ir 使用常规路由工作正常

http://localhost/api/Person?q=me.me

我收到的错误只是属性路由的情况。 我一直在关注这篇关于所有引用的属性路由的文章 - http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2.
How to use attribute routing for sending '.'字符作为字符串的一部分?

尝试将以下内容添加到 <system.WebServer><handlers>...</handlers></system.WebServer> 部分的 Web.config:

<add name="ApiURIs-ISAPI-Integrated-4.0" path="/Search/*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" preCondition="integratedMode,runtimeVersionv4.0" />

我用来解决同样问题的线程:[1]:Dots in URL causes 404 with ASP.NET mvc and IIS

编辑:如果您需要对多条路线执行此操作,您可能必须对路径执行 /*/*