TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ashok
NA
507
80.6k
how to check web api is down or not in c# code
Dec 5 2019 1:22 AM
Hi,
Thanks in advance :)
readonly
string
Baseurl =
"http://localhost:123456/"
;
public
string
GetUserID_By_UserName(
string
Username)
{
string
UserName =
""
;
using
(HttpClient client =
new
HttpClient())
{
client.BaseAddress =
new
Uri(Baseurl);
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Accept.Add(
new
MediaTypeWithQualityHeaderValue(
"application/json"
));
try
{
var response = client.GetAsync(
"api/Values/UserID_By_UserName?username="
+ Username).Result;
// Here how i can check the api is working or not how to get the status to display of the api.
}
}
}
Reply
Answers (
10
)
what is the difference between .net core and asp.net ?
Is there a .Net technology-independent n-Tier Framework?