Forum General
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Do i have to publish my webservice before using it

Hi
I have created a REST web service using ASP.NET core web api. When i tried to use it, it is just getting out of function (not even throwing an error). I have read that Rest web services don't need to be published. Is it true?

BTW,
this is my code for the Web service consumption, i will appreciate it if you can tell me where i am wrong.

           string strUriGetusers = "https://localhost:49391/api/user/getusers";
            using (var objClient = new HttpClient())
            {
                 response = await objClient.GetStringAsync(strUriGetusers);

                var UserList = JsonConvert.DeserializeObject<List<User>>(response);

                UserCollection = new ObservableCollection<User>(UserList);                   
            }

Best Answer

  • pearlshwetapearlshweta Member ✭✭
    Accepted Answer

    Hi,
    i found the answer after a long R&D and feel silly for such an easy answer.
    the line should be
    response = await objClient.GetStringAsync(strUriGetusers).Results;

Answers

Sign In or Register to comment.