分析Web API流量 [英] Analyzing the Web API Traffic

查看:338
本文介绍了分析Web API流量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我已经托管并公开了自定义Web API.我想知道如何获取详细信息,例如谁访问了我的Web API,访问时间等.简而言之,我只想了解我的Web API使用历史.
有可能吗如果是这样,您能在这方面帮我找些什么吗?

谢谢

Hello,

I have custom Web API been hosted and exposed. I want to know how to get details like who accessed my Web API, time of accessing,etc. In short I just want to know my Web API usage history.
Can it be possible? If so, can you please help me in this context for where to look and so?

Thanks

推荐答案

它与流量并没有真正的关系.您可以使用类System.Web.HttpContext:
找到有关当前请求的所有信息. http://msdn.microsoft.com/en-us/library/system.web. httpcontext.aspx [ ^ ],
http://msdn.microsoft.com/zh-cn/library/system.web.httpcontext.current%28v = vs.110%29.aspx [Request.UserHostAddress).依此类推...

提取有关您感兴趣的每个HTTP请求的信息并收集统计信息.

—SA
It isn''t really related to traffic. You can find all the information about the current request using the class System.Web.HttpContext:
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.current%28v=vs.110%29.aspx[^].

For example, HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] gives you client IP (could be just Request.UserHostAddress). And so on…

Pick up information on each HTTP request you are interested in and collect your statistics.

—SA


这篇关于分析Web API流量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆