you have to defined the handler properties in web configuration file to handle the user defined extension request formats. here the user defined extension is ".api"
add verb="*" path="test.api" type="test"
replace the url: "/test.ashx" to url: "/test.api" .