Saturday, March 31, 2012

Trouble authenticating to Remote SQL Server

Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on one
machine and windows xp sp2 on another. The db server is located on the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation. Every
time i try to connect with the asp.net application to the database i get the
following error:

Server Error in '/WebApplication1' Application.
-----------------------
--

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
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
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:

Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:

Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b Line: 46

Stack Trace:

[SqlException: Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers then when
into anonymous logins on IIS and added this user as the anonymous login user
and unchecked the let IIS control the password and typed in the correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql server
(windows authentication) when i use my local account i created on the xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not unless i
have to. Course since i haven't tried it, i might have trouble with it too.

Scratch what i just said above. I tried impersonaltion and it worked but id
rather not use this if at all possible. I want to use the security that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
BrentWhat does your connection string look like? If you are on a workgroup and
NOT in a domain your sql server is not going to know the requesting user.

Have you tried not using a trusted connection and use something like this in
your connection string:

Server=(local);Initial Catalog=pubs;User Id=sa;Password=

-Rob

"Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
news:uUMCZ1V0EHA.3236@.TK2MSFTNGP15.phx.gbl...
> Ok everyone, i have been pulling my hair out on this one. I have been
> working on it for 3 days with no sucess. This problem is occuring at home
> where i am running a workgroup. I have Windows 2003 Ent Server on one
> machine and windows xp sp2 on another. The db server is located on the
> Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
> workstation and the web server is also locally on the xp workstation.
> Every
> time i try to connect with the asp.net application to the database i get
> the
> following error:
> Server Error in '/WebApplication1' Application.
> -----------------------
> --
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection.
> 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
> '(null)'. Reason: Not associated with a trusted SQL Server connection.
> Source Error:
>
> Line 44:
> Line 45: ' fill the dataset
> Line 46: dataAdapter.Fill(ds, "Customers")
> Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
> Line 48:
>
> Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b Line:
> 46
> Stack Trace:
>
> [SqlException: Login failed for user '(null)'. Reason: Not associated with
> a
> trusted SQL Server connection.]
> System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
> isInTransaction)
> System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> tionString options, Boolean& isInTransaction)
> System.Data.SqlClient.SqlConnection.Open()
> System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
> ConnectionState& originalState)
> System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> startRecord,
> Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> behavior)
> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
> WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b:46
> System.Web.UI.Control.OnLoad(EventArgs e)
> System.Web.UI.Control.LoadRecursive()
> System.Web.UI.Page.ProcessRequestMain()
>
> I have tried to following to fix the problem.
> 1) Tried to add the asp.net user to sql server
> 2) Removed tcp/ip from the connect types to sql server
> 3) added a new user which i called "aspnetuser" to both computers then
> when
> into anonymous logins on IIS and added this user as the anonymous login
> user
> and unchecked the let IIS control the password and typed in the correct
> password.
> 4) change the asp.net user that the install of vs.net added and added them
> to the admin group on both machines. I have no problem login into sql
> server
> (windows authentication) when i use my local account i created on the xp
> workstation for me (im in the admin group).
> The only thing i have not used is impersonation and id rather not unless i
> have to. Course since i haven't tried it, i might have trouble with it
> too.
> Scratch what i just said above. I tried impersonaltion and it worked but
> id
> rather not use this if at all possible. I want to use the security that
> vs.net set up for the "asp.net" user. Is this possible without using
> impersonation?
> Thanks,
> Brent
Actually Rob, SQL Server does. I created two identical user accounts on both
the xp box and the windows 2003 box and used the same password. I can log
into query analyzer just fine using windows authentication. My sql server is
set up to use only windows authentication so username/password does not work
and i prefer to keep it this way. Also the server explorer works just fine
under the VS.Net IDE. I appreciate your reply though. Also when i create a
regular vb.net app; windows authentication works just fine.

Brent
"Rob Bazinet" <rbazinet66@.hotmail.com> wrote in message
news:OXR%23uFW0EHA.416@.TK2MSFTNGP10.phx.gbl...
> What does your connection string look like? If you are on a workgroup and
> NOT in a domain your sql server is not going to know the requesting user.
> Have you tried not using a trusted connection and use something like this
in
> your connection string:
> Server=(local);Initial Catalog=pubs;User Id=sa;Password=
> -Rob
> "Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
> news:uUMCZ1V0EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > Ok everyone, i have been pulling my hair out on this one. I have been
> > working on it for 3 days with no sucess. This problem is occuring at
home
> > where i am running a workgroup. I have Windows 2003 Ent Server on one
> > machine and windows xp sp2 on another. The db server is located on the
> > Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
> > workstation and the web server is also locally on the xp workstation.
> > Every
> > time i try to connect with the asp.net application to the database i get
> > the
> > following error:
> > Server Error in '/WebApplication1' Application.
> -----------------------
--
> > --
> > Login failed for user '(null)'. Reason: Not associated with a trusted
SQL
> > Server connection.
> > 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
> > '(null)'. Reason: Not associated with a trusted SQL Server connection.
> > Source Error:
> > Line 44:
> > Line 45: ' fill the dataset
> > Line 46: dataAdapter.Fill(ds, "Customers")
> > Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
> > Line 48:
> > Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b
Line:
> > 46
> > Stack Trace:
> > [SqlException: Login failed for user '(null)'. Reason: Not associated
with
> > a
> > trusted SQL Server connection.]
> > System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
> > isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> > tionString options, Boolean& isInTransaction)
> > System.Data.SqlClient.SqlConnection.Open()
> > System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
> > ConnectionState& originalState)
> > System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> > CommandBehavior behavior)
> > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> > startRecord,
> > Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> > behavior)
> > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable)
> > WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
> > c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b:46
> > System.Web.UI.Control.OnLoad(EventArgs e)
> > System.Web.UI.Control.LoadRecursive()
> > System.Web.UI.Page.ProcessRequestMain()
> > I have tried to following to fix the problem.
> > 1) Tried to add the asp.net user to sql server
> > 2) Removed tcp/ip from the connect types to sql server
> > 3) added a new user which i called "aspnetuser" to both computers then
> > when
> > into anonymous logins on IIS and added this user as the anonymous login
> > user
> > and unchecked the let IIS control the password and typed in the correct
> > password.
> > 4) change the asp.net user that the install of vs.net added and added
them
> > to the admin group on both machines. I have no problem login into sql
> > server
> > (windows authentication) when i use my local account i created on the xp
> > workstation for me (im in the admin group).
> > The only thing i have not used is impersonation and id rather not unless
i
> > have to. Course since i haven't tried it, i might have trouble with it
> > too.
> > Scratch what i just said above. I tried impersonaltion and it worked but
> > id
> > rather not use this if at all possible. I want to use the security that
> > vs.net set up for the "asp.net" user. Is this possible without using
> > impersonation?
> > Thanks,
> > Brent
In this case, you need to add the IIS_WPG account to your database users.

"Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
news:eDG6JRW0EHA.2976@.TK2MSFTNGP12.phx.gbl...
> Actually Rob, SQL Server does. I created two identical user accounts on both
> the xp box and the windows 2003 box and used the same password. I can log
> into query analyzer just fine using windows authentication. My sql server is
> set up to use only windows authentication so username/password does not work
> and i prefer to keep it this way. Also the server explorer works just fine
> under the VS.Net IDE. I appreciate your reply though. Also when i create a
> regular vb.net app; windows authentication works just fine.
> Brent
> "Rob Bazinet" <rbazinet66@.hotmail.com> wrote in message
> news:OXR%23uFW0EHA.416@.TK2MSFTNGP10.phx.gbl...
> > What does your connection string look like? If you are on a workgroup and
> > NOT in a domain your sql server is not going to know the requesting user.
> > Have you tried not using a trusted connection and use something like this
> in
> > your connection string:
> > Server=(local);Initial Catalog=pubs;User Id=sa;Password=
> > -Rob
> > "Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
> > news:uUMCZ1V0EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > > Ok everyone, i have been pulling my hair out on this one. I have been
> > > working on it for 3 days with no sucess. This problem is occuring at
> home
> > > where i am running a workgroup. I have Windows 2003 Ent Server on one
> > > machine and windows xp sp2 on another. The db server is located on the
> > > Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
> > > workstation and the web server is also locally on the xp workstation.
> > > Every
> > > time i try to connect with the asp.net application to the database i get
> > > the
> > > following error:
> > > > Server Error in '/WebApplication1' Application.
> > -----------------------
> --
> > > --
> > > > Login failed for user '(null)'. Reason: Not associated with a trusted
> SQL
> > > Server connection.
> > > 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
> > > '(null)'. Reason: Not associated with a trusted SQL Server connection.
> > > > Source Error:
> > > > > Line 44:
> > > Line 45: ' fill the dataset
> > > Line 46: dataAdapter.Fill(ds, "Customers")
> > > Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
> > > Line 48:
> > > > > Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b
> Line:
> > > 46
> > > > Stack Trace:
> > > > > [SqlException: Login failed for user '(null)'. Reason: Not associated
> with
> > > a
> > > trusted SQL Server connection.]
> > > System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
> > > isInTransaction)
> > > System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> > > tionString options, Boolean& isInTransaction)
> > > System.Data.SqlClient.SqlConnection.Open()
> > > System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
> > > ConnectionState& originalState)
> > > System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> > > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> > > CommandBehavior behavior)
> > > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> > > startRecord,
> > > Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> > > behavior)
> > > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
> srcTable)
> > > WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
> > > c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b:46
> > > System.Web.UI.Control.OnLoad(EventArgs e)
> > > System.Web.UI.Control.LoadRecursive()
> > > System.Web.UI.Page.ProcessRequestMain()
> > > > > I have tried to following to fix the problem.
> > > > 1) Tried to add the asp.net user to sql server
> > > > 2) Removed tcp/ip from the connect types to sql server
> > > > 3) added a new user which i called "aspnetuser" to both computers then
> > > when
> > > into anonymous logins on IIS and added this user as the anonymous login
> > > user
> > > and unchecked the let IIS control the password and typed in the correct
> > > password.
> > > > 4) change the asp.net user that the install of vs.net added and added
> them
> > > to the admin group on both machines. I have no problem login into sql
> > > server
> > > (windows authentication) when i use my local account i created on the xp
> > > workstation for me (im in the admin group).
> > > > The only thing i have not used is impersonation and id rather not unless
> i
> > > have to. Course since i haven't tried it, i might have trouble with it
> > > too.
> > > > Scratch what i just said above. I tried impersonaltion and it worked but
> > > id
> > > rather not use this if at all possible. I want to use the security that
> > > vs.net set up for the "asp.net" user. Is this possible without using
> > > impersonation?
> > > > Thanks,
> > > Brent
> >
Just tried that...that doesn't work either.

"EC" <ec@.notmyrealaddress.com> wrote in message
news:OqqHtuX0EHA.3244@.TK2MSFTNGP10.phx.gbl...
> In this case, you need to add the IIS_WPG account to your database users.
> "Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
> news:eDG6JRW0EHA.2976@.TK2MSFTNGP12.phx.gbl...
>> Actually Rob, SQL Server does. I created two identical user accounts on
>> both
>> the xp box and the windows 2003 box and used the same password. I can log
>> into query analyzer just fine using windows authentication. My sql server
>> is
>> set up to use only windows authentication so username/password does not
>> work
>> and i prefer to keep it this way. Also the server explorer works just
>> fine
>> under the VS.Net IDE. I appreciate your reply though. Also when i create
>> a
>> regular vb.net app; windows authentication works just fine.
>>
>> Brent
>> "Rob Bazinet" <rbazinet66@.hotmail.com> wrote in message
>> news:OXR%23uFW0EHA.416@.TK2MSFTNGP10.phx.gbl...
>> > What does your connection string look like? If you are on a workgroup
>> > and
>> > NOT in a domain your sql server is not going to know the requesting
>> > user.
>>> > Have you tried not using a trusted connection and use something like
>> > this
>> in
>> > your connection string:
>>> > Server=(local);Initial Catalog=pubs;User Id=sa;Password=
>>> > -Rob
>>> > "Brent Waldrop" <brentwa@.spam.hotmail.com> wrote in message
>> > news:uUMCZ1V0EHA.3236@.TK2MSFTNGP15.phx.gbl...
>> > > Ok everyone, i have been pulling my hair out on this one. I have been
>> > > working on it for 3 days with no sucess. This problem is occuring at
>> home
>> > > where i am running a workgroup. I have Windows 2003 Ent Server on
>> > > one
>> > > machine and windows xp sp2 on another. The db server is located on
>> > > the
>> > > Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
>> > > workstation and the web server is also locally on the xp workstation.
>> > > Every
>> > > time i try to connect with the asp.net application to the database i
>> > > get
>> > > the
>> > > following error:
>> >> > > Server Error in '/WebApplication1' Application.
>>> > -----------------------
>> --
>> > > --
>> >> > > Login failed for user '(null)'. Reason: Not associated with a trusted
>> SQL
>> > > Server connection.
>> > > 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
>> > > '(null)'. Reason: Not associated with a trusted SQL Server
>> > > connection.
>> >> > > Source Error:
>> >> >> > > Line 44:
>> > > Line 45: ' fill the dataset
>> > > Line 46: dataAdapter.Fill(ds, "Customers")
>> > > Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
>> > > Line 48:
>> >> >> > > Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b
>> Line:
>> > > 46
>> >> > > Stack Trace:
>> >> >> > > [SqlException: Login failed for user '(null)'. Reason: Not associated
>> with
>> > > a
>> > > trusted SQL Server connection.]
>> > > System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
>> > > isInTransaction)
>> >> >> System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
>> > > tionString options, Boolean& isInTransaction)
>> > > System.Data.SqlClient.SqlConnection.Open()
>> > > System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection
>> > > connection,
>> > > ConnectionState& originalState)
>> > > System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
>> > > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
>> > > CommandBehavior behavior)
>> > > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
>> > > startRecord,
>> > > Int32 maxRecords, String srcTable, IDbCommand command,
>> > > CommandBehavior
>> > > behavior)
>> > > System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
>> srcTable)
>> > > WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
>> > > c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.v b:46
>> > > System.Web.UI.Control.OnLoad(EventArgs e)
>> > > System.Web.UI.Control.LoadRecursive()
>> > > System.Web.UI.Page.ProcessRequestMain()
>> >> >> > > I have tried to following to fix the problem.
>> >> > > 1) Tried to add the asp.net user to sql server
>> >> > > 2) Removed tcp/ip from the connect types to sql server
>> >> > > 3) added a new user which i called "aspnetuser" to both computers
>> > > then
>> > > when
>> > > into anonymous logins on IIS and added this user as the anonymous
>> > > login
>> > > user
>> > > and unchecked the let IIS control the password and typed in the
>> > > correct
>> > > password.
>> >> > > 4) change the asp.net user that the install of vs.net added and added
>> them
>> > > to the admin group on both machines. I have no problem login into sql
>> > > server
>> > > (windows authentication) when i use my local account i created on the
>> > > xp
>> > > workstation for me (im in the admin group).
>> >> > > The only thing i have not used is impersonation and id rather not
>> > > unless
>> i
>> > > have to. Course since i haven't tried it, i might have trouble with
>> > > it
>> > > too.
>> >> > > Scratch what i just said above. I tried impersonaltion and it worked
>> > > but
>> > > id
>> > > rather not use this if at all possible. I want to use the security
>> > > that
>> > > vs.net set up for the "asp.net" user. Is this possible without using
>> > > impersonation?
>> >> > > Thanks,
>> > > Brent
>> >> >>>>
>>

0 comments:

Post a Comment