Closed Novotnde closed 3 years ago
Hello @Novotnde, nice to see you're still using EmbedIO.
A complete explanation of HttpClient
is way beyond me, but I can tell you that the content
parameter must be an instance of a class derived from HttpContent
. Follow the link for the official MS documentation.
As for server-side code, before we even start it would be very helpful to see your Web server initialization code.
No I don't need that , I just I am not sure ow to actually ise the Web Api call and its content in the method. All examples I found had the content right above the client.post so I am just unsure if it will work without he controller?
Well, for a quick test you can use the simplest possible HttpContent: new ByteArrayContent(new byte[0])
.
thank you, this way I get 404 - Not found, so it does not see the [Route(HttpVerbs.Post, "/test/")]
public int PostFile()
{
return 25852;
}
Are you sure your client is requesting the correct path, i.e. /api/test
?
so sorry, I have been trying to make this work for several hours and decided to do this simple sample and even forgot to add the correct path . I am trying to post pdf
This section of the wiki deals specifically with file uploads. You'll have to do some googling for the client-side code, it shouldn't be hard to find. 😉
yes, have seen that. thank you
Hello,
I would kindly ask for explanation of the WebApiConroller and Post.
I am trying to post something, I have tried get but post seems to be better for what I need. I have created only simple sample to return some numbers
And then use client.PostAsync, but client.PostAsync needs two parameters. Url and Content, but the method that return numbers doest get called at all. I am sorry to bother but I can't find any solution even in your cookbook, all examples are of course clear but if you are beginner like me then don't say much.
MY server