gpt4 book ai didi

c# - 将事件写入事件日志期间出现 WCF 异常

转载 作者:太空宇宙 更新时间:2023-11-03 14:10:32 24 4
gpt4 key购买 nike

在托管名为我的机器的 WCF 服务的主机 (Windows 2008 R2) 上写入事件日志时出现异常 来自在域内但在不同计算机上运行的 WCFClient (Windows 7)。

模拟 WCF 客户端以访问服务器上的资源。

到目前为止,以下链接没有帮助

http://support.microsoft.com/kb/2028427#appliesto

http://forums.asp.net/t/1131903.aspx

http://msdn.microsoft.com/en-us/library/Aa379567(关于 SDDL 的详细信息) http://blogs.dirteam.com/blogs/jorge/archive/2008/03/26/parsing-sddl-strings.aspx(SDDL)

关于SO的类似问题没有任何答案 https://stackoverflow.com/questions/6456444/allow-wcf-services-writing-to-custom-event-log-under-windows-2008-r2-server

异常情况如下

System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]:无法打开源“MyService”的日志。您可能没有写入权限。 (Fault Detail 等于 An ExceptionDetail,很可能是由 IncludeExceptionDetailInFaults=true 创建的,其值为:System.InvalidOperationException:无法打开源“MyService”的日志。您可能没有写入权限。 ----> System.ComponentModel.Win32Exception: 访问被拒绝

--- 内部 ExceptionDetail 堆栈跟踪结束 --- 在 System.Diagnostics.EventLogInternal.OpenForWrite(字符串 currentMachineName) 在 System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 事件 ID、UInt16 类别、EventLogEntryType 类型、字符串 [] 字符串、字节 [] 原始数据、字符串 currentMachineName) 在 System.Diagnostics.EventLogInternal.WriteEntry(字符串消息,EventLogEntryType 类型,Int32 eventID,Int16 类别,Byte [] rawData) 在 System.Diagnostics.EventLog.WriteEntry(字符串消息,EventLogEntryType 类型) ...................... .....................

最佳答案

这是自定义事件日志吗?如果是这样,请参阅

http://msdn.microsoft.com/en-us/library/49dwckkz(v=vs.80).aspx

——尤其是

In general, create the new event source during the installation of your application. This allows time for the operating system to refresh its list of registered event sources and their configuration. If the operating system has not refreshed its list of event sources and you attempt to write an event with the new source, the write operation will fail. If creating the source during installation is not an option, then try to create the source well ahead of the first write operation, perhaps during your application initialization. If you choose this approach, be sure your initialization code is running with administrator rights on the computer. These rights are required for creating new event sources.

关于c# - 将事件写入事件日志期间出现 WCF 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8012179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com