无法从.NET中的Windows服务打开ODBC连接 [英] Unable to open ODBC connection from Windows Service in .NET

查看:183
本文介绍了无法从.NET中的Windows服务打开ODBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好, 我编写了一个简单的Windows应用程序,以通过ODBC连接到第三方数据库(普及/林木线).它工作正常,但是当我将相同的代码移到Windows服务时,它无法打开连接.我收到以下错误.

Hi All, I wrote a simple windows application to connect to a third party database (pervasive / timberline) through ODBC. It is working fine but when I moved the same code to a windows service, it is unable to open the connection. I get the following error.

System.Data.Odbc.OdbcException
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, 
    RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, 
    OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, 
    OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options,
    Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(
    DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(
    DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(
    DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()

我将其安装为网络服务.数据库的数据文件在同一台计算机上保留为共享位置,并且该文件夹具有网络服务帐户"的访问权限. 我检查了事件日志,并在发生崩溃时找到了几个条目.我在下面列出了

I installed it as a network service. The Data files for the database is kept as a shared location on the same machine and the folder has the permission for access by Network Services Account. I checked the eventlog and found a couple of entries whenever there is a crash. I have listed below

  1. 故障处理应用程序MyService.exe,版本1.0.0.0,故障模块tsSimba.dll,版本9.6.25.10,故障地址0x0001f74c.
  2. 系统调用了一个自定义组件,该组件发生故障并生成异常.这表明自定义组件存在问题.通知该组件的开发人员发生故障,并向他们提供以下信息.
  1. Faulting application MyService.exe, version 1.0.0.0, faulting module tsSimba.dll, version 9.6.25.10, fault address 0x0001f74c.
  2. The system has called a custom component and that component has failed and generated an exception. This indicates a problem with the custom component. Notify the developer of this component that a failure has occurred and provide them with the information below.

Component Prog ID: 0[ODBC][Env 33012a0]
Method Name: IDispenserDriver::CreateResource
Process Name: MyService.exe
Exception: C0000005
Address: 0x628AF74C
Call Stack: 
tssimba!x_dll_version + 0x1D31F
tssimba!x_dll_version + 0x1DFF3
tssimba!x_dll_version + 0x514B
tssimba!rcCnvConvert + 0x44D

我尝试将服务安装为本地系统",本地服务",用户"模式.但是我一直遇到同样的错误. 请帮忙. 在此先感谢.

I have tried installing the service as Local System, Local Service, User mode. But I kept getting the same error. Please help. Thanks in Advance.

推荐答案

tsSimba.dll是Timberline ODBC驱动程序的一部分,因此您可以尝试一些操作;

  • 使用登录详细信息运行服务,先登录机器然后注销.

  • 确保尚未设置林线以使用映射驱动器代替UNC路径,如果已为此设置,则不能使用UNC路径访问数据文件.

  • 重新安装timberline ODBC模块.

The tsSimba.dll is part of the timberline ODBC driver so there are a couple of things you could try;

  • Run the service using your login details, with you logged into the machine and then logged out.

  • Make sure timberline has not been setup to use mapped drives in place of UNC paths, if it has been setup for this you can''t use UNC paths to access the data files.

  • Re-install the timberline ODBC module.


    这篇关于无法从.NET中的Windows服务打开ODBC连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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