TAPI和Windows Service的AccessViolation异常 [英] AccessViolation exception with TAPI and Windows Service

查看:100
本文介绍了TAPI和Windows Service的AccessViolation异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会尽量使它简短而甜美.

I will try to make this as short and sweet as I possibly can.

我创建了一个应用程序,当我将其作为Windows应用程序运行时,我的公司每天使用该应用程序拨打大约2000个不同的电话号码(用于联系我们在美国部署的非常旧的设备) C#和JulMar ITAPI3包装器),该应用程序运行稳定,没有任何问题,这告诉我至少我的代码基本上是正确的....

I have created an application that is used by my company to call about 2000 different phone numbers each day (used to contact very old devices we have deployed around the US), When I run the application as a Windows Application (written using C# and JulMar ITAPI3 wrapper) the application seems to run rock solid with no issues which tells me at least my code is mostly right....

我遇到的问题是,当我运行与Windows Service相同的代码时(创建新项目并像Windows App一样简单地调用电话拨号库)该服务将运行一段时间(每次都会有所不同) ),然后最终会崩溃.我查看了事件日志,发现它是应用程序中的AccessViolation(0xc0000005).我有一个尝试捕获到进入Tapi包装程序的调用,发生异常,但该捕获从未被击中,我假设它只是使应用程序崩溃,然后才能返回到该点.

The problem I am encountering is when I run the same code as a Windows Service (create new project and simply call into the phone dialing library like the windows app does) The service will run for some period of time (varies each time) and then will finally crash. I look at the event log and see that it is an AccessViolation (0xc0000005) in the application. I have a try catch around my call into the tapi wrapper where the exception is happening but the catch never gets hit, I am assuming that it just crashes the app before it can get back to that point.

因此,简而言之,Tapi应用程序在作为Windows应用程序运行时运行良好,但是当作为Windows服务运行(在本地系统下运行)时最终失败,并出现AccessViolation错误,该错误未被有问题的"函数调用的try catch捕获.

So in a nutshell, Tapi application works great when run as Windows Application but when run as a Windows Service (running under local system) eventually fails with AccessViolation error that is not caught by the try catch around the "offending" function call.

有什么想法吗?

如果有帮助,它将在Windows Server 2008上运行.

This is running on Windows Server 2008 if that helps any.

我尝试以几种不同类型的用户帐户(包括本地用户帐户,域帐户,本地系统)运行此服务.所有这些都出错了.我从事件日志中发布了以下失败之一的片段.

EDIT 1: I have tried running this service as several different types of user accounts including local user account, domain account, local system. All of them error out. I have posted a snippet from the event log for one of the failures below.

      Application: EaglePolloutWindowsService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at <Module>.ATL.CComPtrBase<IUnknown>.{dtor}(ATL.CComPtrBase<IUnknown>*)
   at JulMar.Tapi3.Internal.TapiBase.Compare(IUnknown*)
   at JulMar.Tapi3.TTapi.FindInterface[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](IUnknown*)
   at JulMar.Tapi3.TCall.CreateCallAppearance(JulMar.Tapi3.TAddress, IUnknown*)
   at JulMar.Tapi3.TAddress.CreateCall(System.String, JulMar.Tapi3.LINEADDRESSTYPES, JulMar.Tapi3.TAPIMEDIATYPES)
   at EaglePhoneLibrary.Logic.Outgoing.EaglePollout.CreateNewCall(EaglePhoneLibrary.Entities.ConnectionEntity)
   at EaglePhoneLibrary.Logic.Outgoing.EaglePollout.CallTower(EaglePhoneLibrary.Entities.ConnectionEntity)
   at EaglePhoneLibrary.Logic.Outgoing.EaglePollout.ContinueIteration()
   at EaglePhoneLibrary.Logic.Outgoing.EaglePollout.ContinuePollout(EaglePhoneLibrary.Entities.ConnectionEntity)
   at EaglePhoneLibrary.Logic.Outgoing.EaglePollout+<>c__DisplayClass52.<CallTower>b__4e(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task+<>c__DisplayClassb.<ContinueWith>b__a(System.Object)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

感谢大家到目前为止和将来的帮助.

Thanks to everyone for their help so far and in the future.

我已放弃尝试解决此问题的方法.我最好的猜测是,它源于JulMar如何处理在包装器中创建的一些COM对象的问题.我说服我的公司为TraySoft AddTapi .NET支付了许可证,并且现在可以正常使用了....

Edit 2: I have given up trying to resolve this issue. My best guess is that it stems from an issue with how JulMar is handling some of the COM objects being created in the wrapper. I convinced my company to pay for a license for TraySoft AddTapi .NET and it is working just fine now....

谢谢大家.

推荐答案

当我们将TAPI应用程序作为服务运行时,由于TAPI使用了特定于用户的电话设置,我们总是以特定用户而不是LocalSystem的身份运行它们(拨号规则等).

When we had TAPI applications running as a service, we always had them run as a specific user rather than LocalSystem due to TAPI's use of user-specific phone settings (dialing rules, etc).

TAPI可能试图访问这些设置之一,但由于未配置LocalSystem的用户配置文件而无法访问.

It could be that TAPI is trying to access one of these settings but is unable to because the user profile for LocalSystem hasn't been configured.

这篇关于TAPI和Windows Service的AccessViolation异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆