2012-01-05 105 views
0

我剛剛安裝我的舊電腦來運行SQL Server和VisualSVN。我有一臺筆記本電腦和另一臺電腦,我需要在網站上工作,這就是爲什麼我設置顛覆和sql服務器在一個單獨的電腦上。我已成立的VisualSVN和ToirtoiseSVN但即時得到下面的SQL Server的問題是如何連接到數據庫IM:獲取用戶'NT AUTHORITY ANONYMOUS LOGON'的登錄失敗

Imports API.Database 
Public Class DatabaseHelper 

Private _SqlServer As SQLServer 

Public Sub New() 
End Sub 

Public ReadOnly Property SqlServer() As SQLServer 
    Get 
     If Me._SqlServer Is Nothing Then 
      Me._SqlServer = New API.Database.SQLServer("192.168.1.3", "sa", "xxxxx", "xxxxxx_xxxxxx_xxxxxx") 
     End If 
     Return Me._SqlServer 
    End Get 
End Property 

End Class 



Public Sub New(ByVal server As String, ByVal username As String, ByVal password As String, ByVal database As String) 
     If server = "" Then 
      server = "(local)" 
      //server = "localhost" 
     End If 
     If username = "" Then 
      username = "sa" 
     End If 



     Dim connectionString As String = String.Format("Data Source={0};Initial Catalog={3};Integrated Security=True;Persist Security Info=False;User ID={1};Password={2};", server, username, password, database) 
     //''''''Dim connectionString As String = String.Format("Data Source={0};Initial Catalog={3};User ID={1};Password={2};", server, username, password, database) 


     //''Dim connectionString As String = ConfigurationManager.ConnectionStrings("chatterconnectionstring").ConnectionString 
     Try 
      Me._SQLConnection = New SqlConnection(connectionString) 
      Me._SQLConnection.Open() 
     Catch ex As Exception 
      If True Then 
       Throw ex 
      End If 
     End Try 
    End Sub 

我讀了幾篇文章,發現監守我在另一個位置和運行SQL Server的我在另一個位置的IIS上的Web項目這就是爲什麼我得到權限問題,但我該如何解決這個問題?

我使用SQL Server 2008 Express的R2和Visual Studio 2008

+0

在集成安全=假從IIS或SQL這個錯誤? – user1231231412 2012-01-05 18:13:33

+0

@JonC我相信錯誤來自SQL – redoc01 2012-01-05 18:16:57

+0

您可以使用具有相同憑據的SSMS進行遠程連接嗎? – user1231231412 2012-01-05 18:19:47

回答

2

嘗試設置您的連接字符串

+0

偉大的工作,出色地完成JonC – redoc01 2012-01-05 18:44:24

+0

@ redoc01隨時隨地高興我可以幫忙。只是爲了完整的這個線程。集成安全性忽略連接字符串中的用戶名/密碼並使用應用程序憑證,並且由於其上的模擬使用了匿名憑證 – user1231231412 2012-01-05 18:50:37

相關問題