c# - Attribute Route with constraint works locally but fails when deployed -
c# - Attribute Route with constraint works locally but fails when deployed -
i have simple attribute route 3 different path segments:
[httpget] [get("v{version:int}/{category}/{service}")] public async task<httpresponsemessage> routemessage( string category, string service, int version = 1) { }
while routing works when developing locally, fails (404) when deploy iis server.
the url fails:
http://example.com/v1/search/products?client=test
i'm it's not iis issue because can still access service using non-attribute routing (note though v1
isn't int, parameter has default value):
http://example.com/api/route/?version=v1&category=search&service=products&client=test
i've installed route debugging and, expected, route not match attribute route though should.
the app-relative path listed ~/v1/search/products
, should match url format v{version}/{category}/{service}
("version" correctly listed int route constraint).
here's image total debug info in case helps.
thanks @kiran challa realized that, although similar, built-in webapi attribute routing not same attributerouting.webapi
. switched built-in routing , works fine now.
c# asp.net-web-api attributerouting
Comments
Post a Comment