Mik*_*ePR 7 docker asp.net-core-mvc .net-core asp.net-core .net-mac
我正在使用Mac上的Visual Studio 2017开发ASP.Net核心MVC应用程序。但是,连接到在Docker容器上运行的SQL Server实例时遇到一些问题。
这是我正在使用的连接字符串:
"ConnectionStrings": {
"myCustomConnString": "Server=localhost;Database=myDataBase;User Id=sa;Password=myPassw0rd;Trusted_Connection=True;MultipleActiveResultSets=true"
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
无法使用Kerberos进行身份验证。确保已使用“ kinit”在客户端上初始化了Kerberos,并且已为SQL Server注册了服务主体名称以允许Kerberos身份验证。ErrorCode =内部错误,异常= Interop + NetSecurityNative + GssApiException:GSSAPI操作失败,并显示错误-请求了不受支持的机制(未知的机械代码为0的未知机械)。
使用SQL Operation Studio,Azure Data Studio和/或Visual Studio Code并传递相同的参数,我可以连接到SQL Server的docker实例。但是在运行ASP.Net核心应用程序时不行。因此,我不确定是否缺少连接字符串的任何其他参数。
有人试过吗?
问候!
Ran*_*ger 24
我知道@MikePR 的评论是答案,但我想为我遇到的问题提供更完整的答案。我无法得到dotnet ef database命令使用与连接字符串后执行埃文Trusted_Connection=false。在本文的帮助下,我能够使用此连接字符串:
"ConnectionStrings": {
"myCustomConnString": "Server=localhost,1433\\Catalog=myDatabase;Database=myDatabase;User=username;Password=MYSecurePWD;"
}
Run Code Online (Sandbox Code Playgroud)
现在,我的迁移针对 docker 容器中的 SQL Server 运行。请注意,该文章不包括使用Trusted_Connection=false. 我假设 false 是默认值。
| 归档时间: |
|
| 查看次数: |
1984 次 |
| 最近记录: |