WCF调用随机失败

时间:2013-08-21 17:40:05

标签: c# wcf

任何人都可以提供一些意见来确定问题。

这是我的流程:

  1. 我有一个应用程序执行冗长的图像处理,从单页tiff文件生成多个多页tiff文件,文件分离是扫描单页tiff文件上的条形码。

  2. 多页tiff文件的名称与条形码相同。这些最初存储在临时工作文件夹中。

  3. 我浏览了临时工作文件夹路径中的每个多页tiff文件,提取条形码(文件名)并调用wcf服务以获取网络路径。

  4. 我将多页tiff文件移动到各自的网络路径。

  5. 我的问题是对GetNetworkPath(imageID)的调用随机失败。这是服务跟踪。非常感谢任何帮助。

    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
    at System.Environment.get_StackTrace()
    at System.Diagnostics.TraceEventCache.get_Callstack()
    at System.Diagnostics.XmlWriterTraceListener.WriteFooter(TraceEventCache eventCache)
    at System.Diagnostics.XmlWriterTraceListener.TraceTransfer(TraceEventCache eventCache, String source, Int32 id, String message, Guid relatedActivityId)
    at System.Diagnostics.TraceSource.TraceTransfer(Int32 id, String message, Guid relatedActivityId)
    at System.Runtime.Diagnostics.DiagnosticTrace.TraceTransfer(Guid newId)
    at System.ServiceModel.Diagnostics.ServiceModelActivity.TransferActivity.CreateActivity(Guid activityId, Boolean addTransfer)
    at System.ServiceModel.Diagnostics.ServiceModelActivity.BoundOperationCore(ServiceModelActivity activity, Boolean addTransfer)
    at System.ServiceModel.Diagnostics.ServiceModelActivity.BoundOperation(ServiceModelActivity activity, Boolean addTransfer)
    at System.ServiceModel.Diagnostics.ServiceModelActivity.CreateBoundedActivity(Boolean suspendCurrent)
    at System.ServiceModel.Diagnostics.ServiceModelActivity.CreateBoundedActivity()
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at LookupManagerServiceRef.ILookupManagerService.GetNetworkPath(Int32 _imageID)
    at LookupManagerServiceRef.LookupManagerServiceClient.GetNetworkPath(Int32 _imageID) in C:\Code\Web References\LookupManagerServiceRef\Reference.cs:line 3250
    at Forms.ImageHandler.GetNetworkPath(Int32 _imageID) in C:\Code\ImageHandler.cs:line 452
    at Forms.ImageHandler.MoveImages(String _tmpFolderPath) in C:\Code\ImageHandler.cs:line 391
    at Forms.ImageHandler.ProcessImages(String _sourceFolder, String _tmpFolder, IList`1 _prcBarcodes) in C:\Code\ImageHandler.cs:line 337
    at Forms.ImageHandler.GenerateMultiPageTiffFiles(Int32 _scanBatchID) in C:\Code\ImageHandler.cs:line 58
    at Forms.frmProcessScannedImages.btnProcessBatch_Click(Object sender, EventArgs e) in C:\Code\frmProcessScannedImages.cs:line 44
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason,     Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Program.Main() in C:\Code\Program.cs:line 93
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)`enter code here`
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    

    我尝试检查服务状态并打开服务,如果它出现故障但没有帮助。

    LookupManagerServiceClient client = new LookupManagerServiceClient();
        if (client.State.Equals(System.ServiceModel.CommunicationState.Faulted) ||
            client.State.Equals(System.ServiceModel.CommunicationState.Closing) ||
            client.State.Equals(System.ServiceModel.CommunicationState.Closed))
        {
                 client = new LookupManagerServiceRef.LookupManagerServiceClient();
                }
    _result = client.GetNetworkPath(_imageID);
    

0 个答案:

没有答案
相关问题