c# - Web API call works but gives exception The view 'xxx' or its master was not found or no view engine supports -


strange 1 here, code calls method, , method grabacat executed on server (i debug , step through right end). code returns client, response received 500 internal server error above message. it's saying couldn't find web api method called successfully.

using (var response = await client.postasxmlasync("cats/grabacat", mycatprefs)) {     if (response.issuccessstatuscode) // 500 cats/grabacat not found 

controller code:

[route("~/api/cats/grabacat")] [httppost] public async task grabacat() { } 

after debugging, if change public async task<someobject> grabacat() works ok. lets me return object client. don't want return back; want equivelent calling void method. examine status code determine if successful.

i have got working changing grabacat task , returning new object(); not sure why required. seems crude return empty object work.

any ideas?

the webapi method has route attribute this:

[route("~/api/cats/grabacat")] 

which means url wrong in post request - missing /api prefix:

using (var response = await client.postasxmlasync("api/cats/grabacat", mycatprefs))     //snip 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -