TAPI 和 Windows 服务的 AccessViolation 异常

发布于 12-18 07:42 字数 2867 浏览 6 评论 0原文

我会尽力让这一切变得简短而甜蜜。

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

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

简而言之,Tapi 应用程序在作为 Windows 应用程序运行时工作得很好,但在作为 Windows 服务(在本地系统下运行)运行时最终会失败,并出现 AccessViolation 错误,该错误不会被“有问题的”函数调用周围的 try catch 捕获。

有什么想法吗?

如果有帮助的话,它正在 Windows Server 2008 上运行。

编辑1: 我尝试过以几种不同类型的用户帐户运行此服务,包括本地用户帐户、域帐户、本地系统。全部都出错了。我已经从事件日志中发布了以下故障之一的片段。

      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()

感谢大家迄今为止和未来的帮助。

编辑2:我已经放弃尝试解决这个问题。我最好的猜测是,它源于 JulMar 如何处理在包装器中创建的一些 COM 对象的问题。我说服我的公司支付 TraySoft AddTapi .NET 的许可证费用,它现在工作得很好......

谢谢大家。

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

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....

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.

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.

Any thoughts?

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.

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....

Thanks everyone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初吻给了烟2024-12-25 07:42:06

当我们将 TAPI 应用程序作为服务运行时,我们总是让它们作为特定用户而不是本地系统运行,因为 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).

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文