The second case will not work because id
is a required variable in the route template publish/{id}
. In Web API first route template matching happens and then the action selection process.
other cases:
publish/1
- will not work as actionB
is saying that publishid is required. To prevent this you can change the signature of action to be something likeB(string id, string publishid=null)
and onlyid
is boundpublish/1?publishid=10
- works as expected where both are bound.