我运行WCF Windows服务中。该服务启动并运行良好,我可以访问该服务,并呼吁从同一台机器,(使用localhost作为WCF服务器名称)的WCF方法,但最近改变后,当我尝试调用从另一个WCF方法之一工作站我得到一个System.IO.FileNotFoundException和WCF服务崩溃。在此之前,它工作正常。WCF FileNotFoundException异常
在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的详细信息。
哦,不断有用FNF例外,不告诉你什么该死的文件没有被发现。好吧,我怀疑两件事情 - 无论是它试图加载程序集,或者一个文件,该文件不存在或已被锁定或无法被搜索的一个。那么,你是否试图在StartProcess中加载一个文件?如果是这样,如果不存在,就停止这样做。如果没有,请打开熔合记录器,看看是否有装配负载问题。 – Will
WCF跟踪日志中的任何错误或其他相关信息。过去,我们已经注意到跟踪文件中的服务启动错误信息。 – Seymour
“,但经过最近的一次改变”你改变了什么? – khlr