下面的代码在编码时工作正常。我在IIS中发布代码,然后连接失败。在IIS中部署后SQL服务器连接失败?
我知道,当我编码正给我窗口的登录凭据作为和IIS正在采取程序池身份。我怎样才能将我的Windows登录凭据传递给connectionstring?
Public Shared Function DbCollection(connectionString As String) As DatabaseCollection
Dim server As New Microsoft.SqlServer.Management.Smo.Server(connectionString)
Return server.Databases
End Function
错误:
Login failed for user 'Domain\Computername$'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'Domain\Computername$'.
你为什么想要?这种认证应该使用特定于此目的的服务帐户进行。是否有你想要(或需要)使用你的Windows帐户的原因。我假设你并不是真正意思你的凭证,而是认证用户的凭证。 – 2013-02-18 16:25:31
因为这个应用程序使用我的一个用户,它只会被部署在他的机器上。 – James123 2013-02-18 16:29:35
这还不是做这件事的最好理由。我仍然建议使用这种访问的服务帐户。 – 2013-02-18 16:32:22