1
下面是我用来初始化事件日志的代码,下面是我用来写入日志的示例代码行。WCF服务不写入事件日志
private string sSource = "DaVinci";
private string sLog = "WCF WebService";
//Initialize Event Log
if(!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource, sLog);
//Write openining message
EventLog.WriteEntry(sSource, "Opening WCF Service", EventLogEntryType.Warning);
但是,该程序目前没有按照指示写入日志。没有任何类型的消息正在写入。任何人都可以看到上面的代码有什么问题,或者提供关于在哪里寻找问题的建议?
我将字符串声明更改为以下内容:'private string sLog =“Application”;'它仍然没有写入日志。 – NealR
编辑答案,希望这会有所帮助 – Artless
您是正确的,Web服务没有列在应用程序文件夹下。源代码是否与代码中的名称相同? (在这种情况下:“达芬奇”) – NealR