用于通过Windows 7连接的sql server设置

时间:2016-05-04 14:13:43

标签: c# sql database

我的程序在使用Windows Server 2003和Framework 4.0的Windows XP上运行没有任何问题。我们在计算机上再使用Windows 7,当程序尝试连接数据库时,我们收到有关登录失败的错误。如果我在客户端或服务器上更改某些内容,您能帮助我吗?

错误信息是:

Login failed. the login is from an untrusted domain and cannot be used with windows authentication

Bu iletişim kutusu yerine JIT hata ayıklamayı çağırma hakkında detaylı bilgi için bu iletinin sonuna bakın.

************** Özel Durum Metni ************** System.Data.SqlClient.SqlException (0x80131904): Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.    konum: System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)    konum: System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)    konum: System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)    konum: System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)    konum: System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)    konum: System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)    konum: System.Data.SqlClient.SqlConnection.Open()    konum: stokKontrol.Form1.dbBaglan() C:\Users\Dell\Documents\Visual Studio 2015\Projects\stokKontrol\stokKontrol\Form1.cs içinde: satır 291    konum: stokKontrol.Form1.cariOtoDoldur() C:\Users\Dell\Documents\Visual Studio 2015\Projects\stokKontrol\stokKontrol\Form1.cs içinde: satır 44    konum: stokKontrol.Form1.Form1_Load(Object sender, EventArgs e) C:\Users\Dell\Documents\Visual Studio 2015\Projects\stokKontrol\stokKontrol\Form1.cs içinde: satır 1370    konum: System.Windows.Forms.Form.OnLoad(EventArgs e)    konum: System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    konum: System.Windows.Forms.Control.CreateControl()    konum: System.Windows.Forms.Control.WmShowWindow(Message& m)    konum: System.Windows.Forms.Control.WndProc(Message& m)    konum: System.Windows.Forms.Form.WndProc(Message& m)    konum: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ClientConnectionId:824f06ba-5b8e-455a-9ef8-e53dfe23608c Error Number:18452,State:1,Class:14


************** Yüklü Derlemeler ************** mscorlib
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
---------------------------------------- stokKontrol
    Derleme Sürümü: 1.0.0.0
    Win32 Sürümü: 1.0.0.0
    CodeBase: file://Gunes/d$/gunluk_rapor/addOns/bltBin/stokKontrol/stokKontrol/bin/Debug/stokKontrol.exe
---------------------------------------- System.Windows.Forms
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34251 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
---------------------------------------- System.Drawing
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34270 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
---------------------------------------- System
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34238 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
---------------------------------------- System.Windows.Forms.resources
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_tr_b77a5c561934e089/System.Windows.Forms.resources.dll
---------------------------------------- System.Configuration
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
---------------------------------------- System.Xml
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34234 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
---------------------------------------- System.Data
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
---------------------------------------- System.Transactions
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
---------------------------------------- System.EnterpriseServices
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
---------------------------------------- mscorlib.resources
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_tr_b77a5c561934e089/mscorlib.resources.dll
---------------------------------------- System.Data.resources
    Derleme Sürümü: 4.0.0.0
    Win32 Sürümü: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.resources/v4.0_4.0.0.0_tr_b77a5c561934e089/System.Data.resources.dll
----------------------------------------

************** JIT Hata Ayıklama ************** JIT hata ayıklamayı etkinleştirmek için, bu uygulamanın veya bilgisayarın (machine.config) .config dosyasında system.windows.forms bölümünde jitDebugging değeri ayarlanmış olmalıdır. Ayrıca uygulama hata ayıklama etkin durumdayken derlenmiş olmalıdır.

Örneğin:

<configuration>
    <system.windows.forms jitDebugging="true" /> </configuration>

JIT hata ayıklama etkinken, işlenmemiş özel durumlar bu iletişim kutusunda işlenmek yerine bilgisayarda kayıtlı JIT hata ayıklayıcısına gönderilir.

1 个答案:

答案 0 :(得分:0)

我在更改连接字符串后解决了问题

这 conString =&#34;服务器= GNS; Database = GNSdatabase; User ID = user; Password = 123456; Trusted_Connection = true&#34;

要 conString =&#34;服务器= GNS; Database = GNSdatabase; User ID = user; Password = 123456&#34;

我不知道,Trusted_Connection仅用于Windows身份验证。当我删除它时,程序运行清楚。