我正在尝试在控制台应用程序中打开与 DB2 的连接.它工作正常.当我在托管在 IIS 中的服务中使用相同的代码时,它会为 DB2 引发错误.以下是错误详情.我是否缺少 IIS 中的某些权限?
dll :IBM.data.DB2.dll
代码:
DB2Connection db2Connection = new DB2Connection(connectionString);DB2Command cmdSelectUsrNameAndPassword = new DB2Command(querySelectUsernameAndPassword, db2Connection);cmdSelectUsrNameAndPassword.Connection.Open();
投掷:
<块引用>SQL1159 DB2 .NET 数据提供程序初始化错误,原因码 10,令牌 0.0.0、9.7.3
如果我在控制台中尝试使用 ODBC 的 DSN,它可以工作,但同样会在 IIS 中引发另一个错误.
OdbcConnection DbConnection = new OdbcConnection(DSNName);DbConnection.Open();
投掷:
<块引用>ASP.NET V4.0 无权执行请求的命令或操作.
猜猜它与应用程序池身份有关.我将应用程序池标识设置为网络服务",并在 C:Program FilesIBMSQLLIBBIN etf20_32 中的IBM.Data.DB.dll"上授予网络服务"的完全权限.p>
I am trying to open a connection to DB2 in console application. It works fine. when I use the same code in a service, hosted in IIS it throws an error for DB2. Following is the error details. Am I missing some permissions in IIS ?
dll :IBM.data.DB2.dll
Code :
DB2Connection db2Connection = new DB2Connection(connectionString);
DB2Command cmdSelectUsrNameAndPassword = new DB2Command(querySelectUsernameAndPassword, db2Connection);
cmdSelectUsrNameAndPassword.Connection.Open();
Throws :
SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.3
If I try a DSN with ODBC in console it works, but same throws another error in IIS.
OdbcConnection DbConnection = new OdbcConnection(DSNName);
DbConnection.Open();
Throws :
ASP.NET V4.0 does not have the authority to perform the requested command or operation.
guess it has something to do with App pool identity. I set the app pool identity as "Network service" and gave full permission to "Network Service" on "IBM.Data.DB.dll" in C:Program FilesIBMSQLLIBBIN etf20_32 Worked neat.
这篇关于SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!