{"id":1149,"date":"2010-10-18T01:07:50","date_gmt":"2010-10-18T01:07:50","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=1149"},"modified":"2010-10-18T01:07:50","modified_gmt":"2010-10-18T01:07:50","slug":"%e5%90%91%e7%b3%bb%e7%bb%9f%e4%ba%8b%e4%bb%b6%e6%9f%a5%e7%9c%8b%e5%99%a8%e4%b8%ad%e5%86%99%e5%85%a5%e6%97%a5%e5%bf%97-eventlog-%e5%8f%af%e5%88%9b%e5%bb%ba%ef%bc%8c%e4%b9%9f%e5%8f%af%e5%88%a0%e9%99%a4","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/18\/%e5%90%91%e7%b3%bb%e7%bb%9f%e4%ba%8b%e4%bb%b6%e6%9f%a5%e7%9c%8b%e5%99%a8%e4%b8%ad%e5%86%99%e5%85%a5%e6%97%a5%e5%bf%97-eventlog-%e5%8f%af%e5%88%9b%e5%bb%ba%ef%bc%8c%e4%b9%9f%e5%8f%af%e5%88%a0%e9%99%a4\/","title":{"rendered":"\u5411\u7cfb\u7edf\u4e8b\u4ef6\u67e5\u770b\u5668\u4e2d\u5199\u5165\u65e5\u5fd7-EventLog ,\u53ef\u521b\u5efa\uff0c\u4e5f\u53ef\u5220\u9664\u81ea\u5b9a\u4e49\u7684\u4e8b\u4ef6\u6e90"},"content":{"rendered":"<pre lang=\"csharp\">\r\nusing System.Diagnostics;\r\n\r\n{\r\nstatic void Main(string[] args)\r\n{\r\n    \/\/ Create the source, if it does not already exist.\r\n    if (!EventLog.SourceExists(\"MySource\"))\r\n    {\r\n        \/\/An event log source should not be created and immediately used.\r\n        \/\/There is a latency time to enable the source, it should be created\r\n        \/\/prior to executing the application that uses the source.\r\n        \/\/Execute this sample a second time to use the new source.\r\n        EventLog.CreateEventSource(\"MySource\", \"MyNewLog\");\r\n        Console.WriteLine(\"CreatedEventSource\");\r\n        Console.WriteLine(\"Exiting, execute the application a second time to use the source.\");\r\n        \/\/ The source is created.  Exit the application to allow it to be registered.\r\n        return;\r\n    }\r\n\r\n    \/\/ Create an EventLog instance and assign its source.\r\n    EventLog myLog = new EventLog();\r\n    myLog.Source = \"MySource\";\r\n\r\n    \/\/ Write an informational entry to the event log.    \r\n    myLog.WriteEntry(\"Writing to event log.\");\r\n\r\n\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>using System.Diagnostics; { static void Main(string[] a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-1149","post","type-post","status-publish","format-standard","hentry","category-aspdotnet"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/1149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=1149"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/1149\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=1149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=1149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=1149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}