我在.Net 4.0中尝试使用HttpClient.我读过一些文章说它在4.0中不再受支持但你仍然可以使用它吗?我已经包括了System.Net.Http;集会,但它不允许我提供必要的参数HttpClient.知道如何解决这个问题吗?
我已经加粗了错误发生的地方.
using (HttpClient http = new **HttpClient("{0}/v1/dm/labels/{1}.xml", MI_API_URL**))
{
http.**TransportSettings**.Credentials = new NetworkCredential(apiusername, apipassword);
List<KeyValuePair<string, string>> parms = new List<KeyValuePair<string, string>>();
parms.Add(new KeyValuePair<string, string>("Status", "Wiped"));
HttpResponseMessage response = http.**Get**(new Uri("devices.xml", UriKind.Relative), parms);
response.EnsureStatusIsSuccessful();
responseoutput = response.Content.ReadAsString();
xdoc.LoadXml(responseoutput);
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用服务器访问服务器上的"ForwardedEvents"事件日志
el = new EventLog("ForwardedEvents", serverName);
Run Code Online (Sandbox Code Playgroud)
这不起作用.
我相信它不起作用,因为日志不包含在Eventlog期望找到它的注册表中(HKLM/System/CurrentControlSet/Services/Eventlog/..).
如何将日志添加到注册表以便找到它,或者是否有另一种方法来访问未在该位置指定的日志?