带有“。”的属性路由。在我的Web API项目中不起作用 示例网址不起作用
[RoutePrefix("image")]
public class TestController : ApiController
{
[Route("{uuid}.{extension}")]
public HttpResponseMessage Get([FromUri(Name = "uuid")] string uuid,
[FromUri(Name = "extension")] string extension)
{
// Not coming here with the URL http://localhost:8082/image/TestImage.jpg
}
}
如果我删除了。然后扩展然后它工作。所以,这有效......
[RoutePrefix("image")]
public class TestController : ApiController
{
[Route("{uuid}")]
public HttpResponseMessage Get([FromUri(Name = "uuid")] string uuid//,
//[FromUri(Name = "extension")] string extension)
{
// Works with the URL http://localhost:8082/image/TestImage
}
}
我在本地使用IIS Express。