????? C# ?? ????? ?? ???? ????? ??? ??? ????? ?? ??? ???? ????

???? ?????? ???? ??????
???? ID: 307024 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

?? ??? ?? ??? ???? ???? ???? ???????????? ???????? ?????? ????? ??? ???? ?? ??? Microsoft .NET Framework ?? ????? ?? ?????? ?? ??? ???? ?????? ???

??????????

????? ???? ????? ???? ?? ?? ???????? ?????????, ??????????, ??????? ??????, ?? ?????? ??? ?? ???????? ???? ??:
  • Microsoft Windows 2000 Professional ???, Windows 2000 ?????, Windows 2000 ?????, ?? Windows NT 4.0 ????? ????? ????
  • Microsoft Visual Studio C#

??? ????? ??? ???? ?? ??? ?????

????? ?????? ?????????? ????????? ?? ????????? ?????? ?? ??????? ???? ?? ??? ???? ??????????? ?? ??? ????, centralized ????? ?? ?????? ????? ??? Windows ?? ???, ????? ?????? ?? ????? ?? ??? ?? ???? ?????????? ??????? supplies. ?? ????? ?? ??????? ???? 's ??-???????????????, ?? ?? ???? ??? ?? ????? ??????? ?? ?????? ??????????, ????? ??, ?????? ???? ?? ??? ?????? ????? ??? ?? ???????????? ??? ?? ???? ?? ??? ?????? ?? ?? ?? ?????? ??? ???????????? ?? ??? ?? ???? ???, ?? ???? ????? ????? ??? ?????? ???? simplest ??????? ??? ??? ????? ??? ???? ?? ??? ???? involves ???? ??? ??? ?? ????? ????????? ????? ?? ???? ??? ???? ?? ???, ????? ????? ?? ???? ????::
  1. Visual Studio C# ??????
  2. ????? ??? ??? ????? ????????? ??? ????? C#. ????? ????????? ???? ????????? ???? ?? ?? ???? ????? ??????????? ?? ??? ????
  3. ?????? ?? ????????? ??? ?? ?? System.dll ????? ?? ???? ?????
  4. ??????? ????? ?????? directive??????, ??System.Diagnostics???????? ???? ?? ??? ??? ???? ??? ??? ?? ???????? ?? declarations ????? ????? ?? ??? ?? ????? ?? ???? ?? ???? declarations ???? ?? ???? ?? ????? ?? ????? ???? ?????? ???
    using System;
    using System.Diagnostics;
    					
  5. ??? ????? ??? ??? ?????, ?? ??????? ?? ?? ????? ???? ??????: ???? ?????, ??? ?? ??? ??? ?? ?? ???? (?? ????? ????? ??? ?? ???? ?? ????? ???? ??), ?? ?? ???????? ?? ?? ????? ?? ????? ?? ???????????? ???? ????? ???? ?? ???? ????? ????? ???? ??? ??? ????? ??? ?? ??? ??????? ?? ???? ???; ??? ?? ?? ?? ???? ??? ???? ?? ??? ????? ????? ????? ???, ?? ?? ?????? ????? ????????? ???? ?????? ???
    string sSource;
    string sLog;
    string sEvent;
    
    sSource = "dotNET Sample App";
    sLog = "Application";
    sEvent = "Sample Event";
    					
  6. ?? ????? ??????? ?? ????? ???????????????? ?? ??? ???? ?? ???? ???? ????? ????? ??, ?? ???, ??? ????? ????? ???? ??, ???? ??????? ????? ??? ?? ??? ?????? ?? ?? ?? ????? ????? ?? ???? ??? ???? ?????? ????????? ??? ??? ????? ???? ??, ?? ??? ?? ???????? ??? ?? ??? ????? ??? ??? ???? ?? ??? ???? ????? ????????? ?????? ??????? ??? ??, ??? ?? ?????? ???? ?? ??? ???? ??? ?? ??? ????CreateEventSource???? ??????, ??? ????? ??? "????????? ???."
    if (!EventLog.SourceExists(sSource))
    	EventLog.CreateEventSource(sSource,sLog);
    					
  7. ??? ????? ??? ???? ?? ??? ??? ????? ?????, ?? ??? ?? ?? ????? ?? ???? ???EventLog.WriteEntry???? ????? ??? ?? ???? ?? ?? ???? overloaded ??????? ??? ????? ????? ??? simplest ????, ??? ????? ???????? ?? ???? ????? ?? ?? ???? ???? ??????? ?? ?? ????? ?????? ?? ????? ID ?? ????????? ???? ?? ?????? ???? ?? ?? ?????? ??:
    EventLog.WriteEntry(sSource,sEvent);
    EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,  234);
    					
  8. ???? ????????? ?? ??????? ???? ????????? ?????, ?? ???? ??? ???? ?? ????? ?? ????? ?? ??? ????? ?????? ??? ????????? ??? ?? ???? ?????

??? ??????? ?????

using System;
using System.Diagnostics;

namespace WriteToAnEventLog_csharp
{
	/// Summary description for Class1.
	class Class1
	{
		static void Main(string[] args)
		{
			string sSource;
			string sLog;
			string sEvent;

			sSource = "dotNET Sample App";
			sLog = "Application";
			sEvent = "Sample Event";

			if (!EventLog.SourceExists(sSource))
				EventLog.CreateEventSource(sSource,sLog);

			EventLog.WriteEntry(sSource,sEvent);
			EventLog.WriteEntry(sSource, sEvent,
				EventLogEntryType.Warning, 234);
		}
	}
}
				

???

???? ID: 307024 - ????? ???????: 03 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Visual C# 2008 Express Edition
  • Microsoft Visual C# 2005
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
??????: 
kbdebug kbhowtomaster kbmt KB307024 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:307024

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com