无法在运行时2中使用.Net SqlClient。遇到有关缺少引用的以下错误:2018-04-09T13:48:51.172 [信息]编译失败。2018-04-09T13:48:58.071 [信息]函数'SqlExecutorActivity'的脚本已更改。正在重新加载。2018-04-09T13:48:58.363 [错误] run.csx(29,5):错误CS0246:找不到类型或名称空间名称'SqlConnectionStringBuilder'(您是否缺少using指令或程序集引用?)2018-04-09T13:48:58.376 [错误] run.csx(29,68):错误CS1069:在名称空间'System.Data.SqlClient'中找不到类型名称'SqlConnectionStringBuilder'。此类型已转发给程序集'System.Data.SqlClient,版本= 4.2.0.2,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'考虑添加对该程序集的引用。2018-04-09T13:48.58 [错误] run.csx(71,28):错误CS0246:找不到类型或名称空间名称'AzureServiceTokenProvider'(您是否缺少using指令或程序集引用?)2018-04-09T13:48.58 [错误] run.csx(78,27):错误CS0246:找不到类型或名称空间名称'SqlConnection'(您是否缺少using指令或程序集引用?)2018-04-09T13:48:58.417 [错误] run.csx(83,30):错误CS0246:找不到类型或名称空间名称'SqlCommand'(您是否缺少using指令或程序集引用?)#r "System.Data"using System.Threading;using System.Threading.Tasks;using Newtonsoft.Json;using System.Data.SqlClient;using System.Collections.Generic;public static async Task<string> Run(string requestData, TraceWriter log){ dynamic data = JsonConvert.DeserializeObject<MaintQueueData>(requestData); log.Info($"Doing work in Server {data.Server}.");SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder["Server"] = data.Server; builder["Initial Catalog"] = data.Database; builder["Connect Timeout"] = 30; builder["Trusted_Connection"] = true; builder["Integrated Security"] = false; log.Info($"{builder.ConnectionString} ... HAHA no passwords br0ski!"); var token = (String)null; var result = (String)null; try { token = await ADAuthentication.GetSqlTokenAsync(); }catch(Exception e) { string error = $"Failed to authenticate with AAD: {e.Message}"; log.Error($"{error}"); return error; }
1 回答
- 1 回答
- 0 关注
- 205 浏览
添加回答
举报
0/150
提交
取消