首页 新闻 会员 周边

C#控制台程序添加到系统计划任务后数据库连接出错

0
悬赏园豆:10 [待解决问题]

我这边有个控制台程序,添加到计划任务后 在如下图设置都要运行时,数据库连接就出错,提示连接不到服务器 !(A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server))
, 但选择账户登录时运行的话就不会有这问题 .

数据库为 2016 系统为window2013 服务器版

连接串是在程序里写死了, 请问这是什么原因造成的连接出错?

< >
分享
所有回答(2)
0

这应该是使用的管道连接并且使用的系统认证,你直接开网络吧使用sql server认证方式。

花飘水流兮 | 园豆:13560 (专家六级) | 2019-07-30 17:51

指数据库服务端的认证?

支持(0) 反对(0) 望着天的蜗牛 | 园豆:354 (菜鸟二级) | 2019-07-31 12:01
0

勾选上使用最高权限运行, 选择不管用户是否登录都要运行 也可.
原因还是不明.

望着天的蜗牛 | 园豆:354 (菜鸟二级) | 2019-07-31 12:00
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册