我正在Windows服务中运行WCF。该服务启动并运行良好,我可以访问该服务并从同一台机器调用WCF方法(使用LocalHost作为wcf服务器名称),但是在最近的更改之后,当我试图从另一个工作站调用WCF方法时,我将得到一个System.IO.FileNotFoundException和WCF服务崩溃。在那之前一切都很顺利。
wcf服务器上的应用程序日志中的错误如下所示:没有指示它无法加载哪个文件。
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-12-29T18:33:27.000Z" />
<EventRecordID>3292</EventRecordID>
<Channel>Application</Channel>
<Computer>LASAPPTEST.rose.portland.local</Computer>
<Security />
</System>
- <EventData>
<Data>Application: CoP.Enterprise.ServiceHost.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info:
System.IO.FileNotFoundException Stack: at CoP.LAS.LASServiceHostProcessManager.StartProcess() at
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run
(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()
</Data>
</EventData>
</Event>想法?有什么方法可以调试这个程序并找出下一步的方向吗?它要加载什么文件?
使用@seymour的提示,找到答案:使用Wcf跟踪日志功能(添加到web.config/app.config )
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "C:\LASServices\LAS\Logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>并使用Wcf跟踪日志查看器(SvcTraceViewer.exe)来读取FileNotFoundException的详细信息。
发布于 2014-12-30 11:11:03
我们发现一种帮助确定WCF服务主机启动问题(如FileNotFoundException )的根本原因的方法是启用WCF跟踪。通常情况下,WCF跟踪日志将显示以前“隐藏”的问题。
http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx
https://stackoverflow.com/questions/27694326
复制相似问题