首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF FileNotFoundException

WCF FileNotFoundException
EN

Stack Overflow用户
提问于 2014-12-29 18:50:18
回答 1查看 870关注 0票数 1

我正在Windows服务中运行WCF。该服务启动并运行良好,我可以访问该服务并从同一台机器调用WCF方法(使用LocalHost作为wcf服务器名称),但是在最近的更改之后,当我试图从另一个工作站调用WCF方法时,我将得到一个System.IO.FileNotFoundException和WCF服务崩溃。在那之前一切都很顺利。

wcf服务器上的应用程序日志中的错误如下所示:没有指示它无法加载哪个文件。

代码语言:javascript
复制
<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 )

代码语言:javascript
复制
<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的详细信息。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-30 11:11:03

我们发现一种帮助确定WCF服务主机启动问题(如FileNotFoundException )的根本原因的方法是启用WCF跟踪。通常情况下,WCF跟踪日志将显示以前“隐藏”的问题。

http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27694326

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档