[英]UWP SQL connection Error [c#]
我嘗試使用SQL Server憑據連接到SQL Server 2008實例。
使用WPF應用程序,我沒有問題。
我遵循以下示例: https : //docs.microsoft.com/zh-cn/windows/uwp/data-access/sql-server-databases
我已閱讀以下內容: 如何從Windows 10 UWP應用連接到SQL Server數據庫
我的連接字符串是:
static private string connectionString =
@"Data Source=SERVER\SQLSERVER;Initial Catalog=Something;
Integrated Security=false;Persist Security Info=True;User ID=user;Password=pass";
conn = new SqlConnection(connectionString);
try
{
conn.Open();
}
catch(Exception z)
{
Debug.WriteLine(z.ToString());
}
我得到這個錯誤
System.Data.SqlClient.SqlException(0x80131904):已成功與服務器建立連接,但是在登錄過程中發生錯誤。 (提供者:TCP提供程序,錯誤:0-操作結果)
如果我嘗試
static private string connectionString =
@"Data Source=SERVER\SQLSERVER;Initial Catalog = Something;
Integrated Security=true;User ID = user;Password= pass";
我得到這個錯誤
System.Data.SqlClient.SqlException(0x80131904):無法生成SSPI上下文。 錯誤碼= DowngradeDetected
集成安全性= SSPI時出現相同的錯誤
如果有人有主意嗎?
感謝Benoit
您需要檢查appx清單中訪問網絡資源所需的適當功能。 在VS中打開Package.appxmanifest,然后轉到“功能”標簽。
試試這個代碼
optionsBuilder.UseSqlServer(“數據源= SERVER \\ SQLSERVER;初始目錄=某些東西;集成安全性= False;用戶ID =用戶;密碼=通過; MultipleActiveResultSets = True”);
我記得可以通過為服務器安裝小型修復程序來解決此問題,在此之前,請嘗試其他服務器
我記得第三種情況,即安裝Kerberos,請參閱鏈接https://support.microsoft.com/en-us/help/811889/how-to-troubleshoot-the-cannot-generate-sspi-context-error-message從此處下載並安裝鏈接https://www.microsoft.com/zh-cn/download/details.aspx?id=39046
我嘗試使用新的VM和SQL EXPRESS 2014正常運行。
我認為UWP和SQL SERVER 2008不兼容。
感謝您的幫助,Rami。
伯努瓦
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.