【发布时间】:2018-11-27 00:01:24
【问题描述】:
我正在尝试使用 Azure Cloud 中的配置连接到 SQL 服务器数据库:
var config = {
user: UserName,
password: Password,
server: Server IP,
dialect:'mssql',
options: {database: DBName}
};
sql.connect(config, function (err) {
//Code
}
代码在 node.js 中,在我的远程桌面上运行良好。但是在我将它托管在 Azure Cloud 中之后,我一直遇到这个错误
ConnectionError: 无法连接到 {SQLServerDB} - 连接 EACCES {SQLServerDB} 在 Connection.tedious.once.err (D:\home\site\wwwroot\node_modules\mssql\lib\tedious.js:216:17) 在 Connection.g (events.js:291:16) 在 emitOne (events.js:96:13) 在 Connection.emit (events.js:188:7) 在 Connection.socketError (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:1004:14) 在 D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:869:25 在 Socket.onError (D:\home\site\wwwroot\node_modules\tedious\lib\connector.js:49:9) 在 emitOne (events.js:96:13) 在 Socket.emit (events.js:188:7) 在 emitErrorNT (net.js:1276:8) 代码:'ESOCKET',originalError:{ ConnectionError:无法连接到 {SQLServerDB} - 在 ConnectionError (D:\home\site\wwwroot\node_modules\tedious\lib\errors.js:12:12) 处连接 EACCES {SQLServerDB} 在 Connection.socketError (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:1004:30) 在 D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:869:25 在 Socket.onError (D:\home\site\wwwroot\node_modules\tedious\lib\connector.js:49:9) 在 emitOne (events.js:96:13) 在 Socket.emit (events.js:188:7) 在 emitErrorNT (net.js:1276:8) 在 _combinedTickCallback (内部/进程/next_tick.js:74:11) 在 process._tickDomainCallback (internal/process/next_tick.js:122:9) 消息:'无法连接到 {SQLServerDB} - 连接 EACCES {SQLServerDB}, 代码:'ESOCKET' },名称:'ConnectionError' }
SQL Server 正在使用默认端口并且 TCP/IP 已启用。
【问题讨论】:
标签: sql-server node.js azure