繁体   English   中英

ConnectionError:无法连接到 <SQLServerDB> -连接EACCES <SQLServerDB>

[英]ConnectionError: Failed to connect to <SQLServerDB> - connect EACCES <SQLServerDB>

我正在尝试使用Azure Cloud的配置连接到SQL Server数据库:

       var config = {
              user: UserName,
              password: Password,
              server: Server IP,
              dialect:'mssql',
              options: {database: DBName}
          };
    sql.connect(config, function (err) {
//Code
}

该代码位于node.js中,并且在我的远程桌面上运行良好。 但是在将其托管在Azure云中之后,我继续遇到此错误

ConnectionError:无法连接到{SQLServerDB}-在Connection处通过Connection.tedious.once.err(D:\\ home \\ site \\ wwwroot \\ node_modules \\ mssql \\ lib \\ tedious.js:216:17)连接EACCES {SQLServerDB}。 g(events.js:291:16)在emitOne(events.js:96:13)在Connection.emit(events.js:188:7)在Connection.socketError(D:\\ home \\ site \\ wwwroot \\ node_modules \\ D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connection.js:869:25在Socket.onError(D:\\ home \\ site \\ wwwroot \\ node_modules)中的乏味\\ lib \\ connection.js:1004:14) \\\\ tedious \\ lib \\ connector.js:49:9)在emissionOne(events.js:96:13)在Socket.emit(events.js:188:7)在emitErrorNT(net.js:1276:8)代码: 'ESOCKET',原始错误:{ConnectionError:无法连接到{SQLServerDB}-在ConnectionError处连接EACCES {SQLServerDB}(D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ errors.js:12:12) .socketError(D:\\ home \\ site \\ wwwroot \\ noderoot_modules \\ tedious \\ lib \\ connection.js:869:25处的D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connection.js:1004:30) Socket.on 在Socket.emit(events.js:188:7)的emitOne(events.js:96:13)发生错误(D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connector.js:49:9)在process._tickDomainCallback(internal / process / next_tick.js:122:9)的_combinedTickCallback(internal / process / next_tick.js:74:11)处发出错误(NT.js:1276:8)消息:'无法连接到{ SQLServerDB}-连接EACCES {SQLServerDB},代码:'ESOCKET'},名称:'ConnectionError'}

SQL Server使用默认端口,并且启用了TCP / IP。

根据错误信息,表明它无法连接到您的SQL Server。 我假设您正在使用本地SQL Server。

在这种情况下,默认情况下,webapp无法连接本地SQL服务器。 您可以使用混合连接来确保可以连接到本地SQL Server。 我还建议您可以使用Azure SQL数据库替换本地SQL Server。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM