Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, March 30, 2012

Login failed for user NT AUTHORITY\NETWORK SERVICE

I have built a web page in visual web developer express and I moved it over to use IIS. I gave NT AUTHORITY\NETWORK SERVICE read and write permissions to the folder and included it in my IIS virtual folder. I can see the login page just fine. I can create a user just fine. I can even access the forgot password page just fine. But if I try to login in I get this stack trace. I can't figure out what more I need to do for NT AUTHORITY\NETWORK SERVICE. Can any one help.

Server Error in '/' Application.

Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

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: Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735043 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Hi matt,

You have using Integrated Security=SSPI in your connection string. You would have to use: User ID and Password.

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||

This is a common login failure when the application runs under IIS, and the 'NT AUTHORITY\NETWORK SERVICE' is the account used by IIS6.0. You may take a look at this post:

http://forums.asp.net/thread/1325077.aspx

sql

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Hello all -

I'm trying to connect to a Sql Server 2005 database from my local development machine, which is running IIS 5.1 (Windows XP Pro). The web application is not using impersonation and has anonymous access enabled. In my system's machine.config file, I've set the processModel section to look like:

<processModel userName="System" password="AutoGenerate" />

This has been working fine for us connecting to SQL Server 2000 databases (running on Windows 2003). When we connect, I access Sql 2000 databases under the context of "OurDomain\MyMachineName$". However, we've recently installed Sql Server 2005 on a new Windows 2003 server & when I connect to that server, I receive the error:

System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

when trying to call the SqlConnection.Open() method. Our connection string is very basic:

Data Source=sql-dev2; Initial Catalog=TestDatabase; Integrated Security=True; Application Name=PrototypeWebservice;

In the Sql Server logins, we've granted the computer account "OurDomain\MyMachineName$" db_owner access to every database (in both Sql Server 2000 & 2005).

I am able to connect to the Sql Server 2005 databases if I change my section in machine.config to <processModel userName="OurDomina\myPersonalAccount" password="myPersonalPwd"/>, or if I move the application to an IIS6 server & set the application pool identity to NETWORK SERVICE, but we'd like to continue accessing our Sql Server 2005 databases (from our development machines running IIS5.1) as we currently access our Sql Server 2000 databases; under the context of "OurDomain\MyMachineName$".

Would anyone have any ideas why this would be happening or how to resolve? Thanks in advance.

Please check this blog: http://blogs.msdn.com/sql_protocols/archive/2006/12/02/understanding-kerberos-and-ntlm-authentication-in-sql-server-connections.aspx

.....

[1] "Login Failed for user 'NT Authority\ANONYMOUS' LOGON"

In this scenario, client make tcp connection, and it is most likely running under LocalSystem account, and there is no SPN registered for SQL instance, hence, NTLM is used, however, LocalSystem account inherits from System Context instead of a true user-based context, thus, failed as 'ANONYMOUS LOGON'. See http://support.microsoft.com/kb/132679.

The workaround here is

a. ask your domain administrator to manually register SPN if your SQL Server running under a domain user account.

b. use NP connection.

c. change your sql server to run under either localsystem account or networkservice account.

|||

That was the ticket!!! Thank you very much.

For future reference, the problem we ran into was that we had multiple active directory accounts registered with the same SPN. One entry was registered under the computer account sql server was running on & the other was the user account the sql server service was running under. We detected this by looking into the System event log on the domains PDC (the entry was EventID 11, Source KDC. Exact steps we followed were those suggested by other users on the thread: http://www.eventid.net/display.asp?eventid=11&eventno=569&source=KDC&phase=1). After removing the entry for the computer account, kerberos authentication succeeded.

Thanks again!

|||Thanks for the feedback.

Wednesday, March 28, 2012

Login failed for user DOTNETSPIDER2\dotnetspider

i am using this free web host site (www.aspspider.net), i was able to successfully upload my ASPNETDB.mdf to their server but unfortunately this error appears preventing me from attaching the db to their server, ive asked the help of the webmaster apparently hes not also sure what causes the error... any help will be very much appreciated... thanks:)

Error attaching database. System.Data.SqlClient.SqlException: The operating system returned error 38(Reached the end of the file.) to SQL Server during a read at offset 0000000000000000 in file 'c:\MemberSites\ecommunic8\database\ASPNETDB.MDF'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at HostingUtils.HostManager.AttachDatabase(String userId, String databaseName, String dataFile)
Error opening attached database. Cannot open database "ecommunic8_ASPNETDB" requested by the login. The login failed. Login failed for user 'DOTNETSPIDER2\dotnetspider'.

SQL Express does not scale in a shared hosting environment. Please see this thread for more information:http://forums.asp.net/1108647/ShowPost.aspx.|||Sounds like the upload didn't take. If you are transferring it by FTP, make sure that you are using binary instead of ascii.|||

Motley wrote:

Sounds like the upload didn't take. If you are transferring it by FTP, make sure that you are using binary instead of ascii.

actually, i was able to successfully upload the database... the error prevents me from attaching it to their server...

login failed for user after moving app to web server

My app works fine in development server. After moving to web server, error occured as bellow. Can someone help me? I use vs 2005 and SQL server is windows authentication mode.

Login failed for user 'domain_name\REPORT$'.

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_name\REPORT$'.

Source Error:

Line 348:Line 349: If MyTable = Nothing ThenLine 350: MySQLDataAdapter.Fill(MyDataSet)Line 351: ElseLine 352: MySQLDataAdapter.Fill(MyDataSet, MyTable)

Hi,

Are you running your application (web server) on a windows 2003 server ? If yes then you have to add a login withdomain_name\<machine_name>$ and you have to grant access to the operative database to this login. This login weill be a windows account (domain not machine).

Hope it Helps!

Bhaskar!

Monday, March 26, 2012

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Hi,
I'm new here guys.
I'm developing a web application that's using a separate component to access data from SQL Server 2000. This component uses DAAB of EL June 2005. This data access component resides on a different server from the database server. I would just like to ask if what's the cause of this error. I wonder why it doesn't get the actual user I'm passing?

"Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
Our database admin had the database server in mixed mode authentication already.
I don't know if this will help but I'll share the contents of my config files.
web.config contains:
<enterpriselibrary.configurationSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" applicationName="Application" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
<configurationSections>
<configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="dataConfiguration" encrypt="false">
<storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="dataConfiguration.config" />
<dataTransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includeTypes />
</dataTransformer>
</configurationSection>
</configurationSections>
<keyAlgorithmStorageProvider xsi:nil="true" />
<includeTypes />
</enterpriselibrary.configurationSettings>

dataconfiguration.config contains
<?xml version="1.0" encoding="utf-8"?>
<dataConfiguration>
<xmlSerializerSection type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null">
<enterpriseLibrary.databaseSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" defaultInstance="something" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/data">
<databaseTypes>
<databaseType name="Sql Server" type="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null" />
</databaseTypes>
<instances>
<instance name="something" type="Sql Server" connectionString="something" />
</instances>
<connectionStrings>
<connectionString name="something">
<parameters>
<parameter name="data source" value="dbserver" isSensitive="false" />
<parameter name="initial catalog" value="dbname" isSensitive="false" />
<parameter name="Integrated Security" value="SSPI" isSensitive="false" />
<parameter name="password" value="password" isSensitive="true" />
<parameter name="user id" value="userid" isSensitive="false" />
</parameters>
</connectionString>
</connectionStrings>
</enterpriseLibrary.databaseSettings>
</xmlSerializerSection>
</dataConfiguration>

Also, do I need to create an app.config and another dataconfiguration.config files in my data access component?

Hoping for your replies guys. Thanks in advance!

This KB can help you.

http://support.microsoft.com/default.aspx/kb/307002.

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server conn

Currently, i'm using Visual Web Developer 2005 to create my web site.

Once i connect to database, it's comes out this error for me "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
I'm try to connect the database in microsoft server 2000.

How can I solve it?Can your mention what connection string you write in your code

Friday, March 23, 2012

Login failed for user (null)

I am creating a Data Web Form using the Data Form Wizard.
After configuring a valid connection to a SQL Server on my network, I receive the following error when trying to run the page: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
Any ideas?

Thanks,
MarkYou need to put a proper user id and password in your connection string? Or you haven't filled out the properties properly to do the click and drag method.|||Kay -
Thanks for the response.
I initially configured the connection to use Windows Authentication. Since this didn't work, I entered my username and password using SQL Authentication. Neither seems to work. Now, I'm thinking it has something to do with not having the ASPNET username set up as having access to the SQL database.
Does this make sense?

Mark|||Did you try using IUSR_machinename?|||Jake -
What exactly is IUSR_machinename?
Where would I reference this in my connection string?

Thanks,
Mark|||Are you doing this on an Intranet or are you using a webhost?

IUSR_machinename is an anonymous internet user set up by IIS.|||I am attaching to my localhost for testing purposes.
If I attach to a SQL database on my local machine, I have no problems with the login.
If I try attaching to a database on any other server, I receive the error.

Mark|||Here's my connection string in my web.config


<appSettings>
<add key="connString" value="server=66.24.255.01;pwd=Jeckel;uid=Jake;database=JakeJeck" />
</appSettings>

What does your connection string look like?|||Jake -
I don't have an <appSettings> tag within my web.config file.
I added one using your example, but receive an error about an unrecognizable configuration section.
Where else could my connection string be located?

Thanks,
Mark|||Your entire web.config could look something like this:


<?xml version="1.0" encoding="utf-8" ?>
<configuration
<appSettings>
<add key="connString" value="server=69.56.xxx.xxx;uid=xxx;pwd=xxx;database=JakeJeck"/>
</appSettings
<system.web>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="vb" debug="true" /
<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.
-->
<customErrors mode="RemoteOnly" /
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"
-->
<authentication mode="Forms" /
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<allow users="*" /> <!-- Allow all users --
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization
<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /
<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false"
timeout="20"
/
<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8" /
</system.web
</configuration>

Then you simply access connString and you have your connection information available.sql

Wednesday, March 21, 2012

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Hello all -

I'm trying to connect to a Sql Server 2005 database from my local development machine, which is running IIS 5.1 (Windows XP Pro). The web application is not using impersonation and has anonymous access enabled. In my system's machine.config file, I've set the processModel section to look like:

<processModel userName="System" password="AutoGenerate" />

This has been working fine for us connecting to SQL Server 2000 databases (running on Windows 2003). When we connect, I access Sql 2000 databases under the context of "OurDomain\MyMachineName$". However, we've recently installed Sql Server 2005 on a new Windows 2003 server & when I connect to that server, I receive the error:

System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

when trying to call the SqlConnection.Open() method. Our connection string is very basic:

Data Source=sql-dev2; Initial Catalog=TestDatabase; Integrated Security=True; Application Name=PrototypeWebservice;

In the Sql Server logins, we've granted the computer account "OurDomain\MyMachineName$" db_owner access to every database (in both Sql Server 2000 & 2005).

I am able to connect to the Sql Server 2005 databases if I change my section in machine.config to <processModel userName="OurDomina\myPersonalAccount" password="myPersonalPwd"/>, or if I move the application to an IIS6 server & set the application pool identity to NETWORK SERVICE, but we'd like to continue accessing our Sql Server 2005 databases (from our development machines running IIS5.1) as we currently access our Sql Server 2000 databases; under the context of "OurDomain\MyMachineName$".

Would anyone have any ideas why this would be happening or how to resolve? Thanks in advance.

Please check this blog: http://blogs.msdn.com/sql_protocols/archive/2006/12/02/understanding-kerberos-and-ntlm-authentication-in-sql-server-connections.aspx

.....

[1] "Login Failed for user 'NT Authority\ANONYMOUS' LOGON"

In this scenario, client make tcp connection, and it is most likely running under LocalSystem account, and there is no SPN registered for SQL instance, hence, NTLM is used, however, LocalSystem account inherits from System Context instead of a true user-based context, thus, failed as 'ANONYMOUS LOGON'. See http://support.microsoft.com/kb/132679.

The workaround here is

a. ask your domain administrator to manually register SPN if your SQL Server running under a domain user account.

b. use NP connection.

c. change your sql server to run under either localsystem account or networkservice account.

|||

That was the ticket!!! Thank you very much.

For future reference, the problem we ran into was that we had multiple active directory accounts registered with the same SPN. One entry was registered under the computer account sql server was running on & the other was the user account the sql server service was running under. We detected this by looking into the System event log on the domains PDC (the entry was EventID 11, Source KDC. Exact steps we followed were those suggested by other users on the thread: http://www.eventid.net/display.asp?eventid=11&eventno=569&source=KDC&phase=1). After removing the entry for the computer account, kerberos authentication succeeded.

Thanks again!

|||Thanks for the feedback.

Login failed for user

I published my web pages using Visual Studio 2005 to a local IIS server, the local machine has a proxie, when I published the pages on my personal laptop with a practice database on a SQL server it runs find, but when I put it on the machine with the actual running database on SQL Server 2005 I get the following error, can any please let me know what I can do to fix this problem.

Server Error in '/BPAlarmQuery' Application.

Login failed for user 'ODOWIN911\ASPNET'.

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 'ODOWIN911\ASPNET'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): Login failed for user 'ODOWIN911\ASPNET'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734787 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92 System.Web.UI.WebControls.ListControl.PerformSelect() +31 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

Thank you in advance.

Try the suggestions on this page:

http://msdn2.microsoft.com/en-us/library/ab4e6cky.aspx

Login failed for user

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

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 'NT AUTHORITY\NETWORK SERVICE'.

Source Error:

Line 15: Dim cmd As New SqlCommand
Line 16: con6 = New SqlConnection("Server=localhost;UID=sa;PWD=XXXX;Database=knowledge;integrated security=sspi")
Line 17: con6.Open()
Line 18: cmd.CommandText = "select Status from usr where Uid='" & txtUsername.Text & "' and Pass='" & txtPassword.Text & "'"
Line 19: cmd.Connection = con6


Source File:D:\Visual Studio 2005\Projects\WebApplication11\WebApplication11\login.aspx.vb Line:17

When I try the same code at my home computer it gives the same error as

Login failed for user 'BLACK-HULK\ASPNET'.

I am using XP at home and Server 2003 at the other computer, while debugging the application seems to be working fine dunno wat goes wrong while running it directly



I am not 100% sure, but when you use Integrated Security, the connection looks into windows and see who is logged on (basically). Thats why it says: LOGIN FAILED FOR USER 'BLACK-HULK\ASPNET.

As I see it, it gives no meaning of adding UID and PWD when you use Integrated Security.

Can you try removing Integratied security from you connectionstring.

|||

I would highly recommend against accessing your database with sa as a login. Also, as suggested before, using integrated security, kind of defeats the purpose of putting in a username and password ;)

HTH.

Peter

login failed for user

hi,
i have developed a web application. i need to connect to sqlserver 2000
to fetch data and i am getting the following error when requested for
login page.

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

When i refresh the page it is working properly, i.e., i could see the
login screen.

what is the solution for this problem?

Kalaivanankalaivanan (mail2kalai@.gmail.com) writes:

Quote:

Originally Posted by

i have developed a web application. i need to connect to sqlserver 2000
to fetch data and i am getting the following error when requested for
login page.
>
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
>
When i refresh the page it is working properly, i.e., i could see the
login screen.
>
what is the solution for this problem?


Looks as if the web server is trying to log in with its service account.
What does your connect string look like? Are you using Windows
authentication or SQL authentication?

If you are using Windows authentication, this is likely to be an issue
that requires knowledge of IIS (or whatever webserver you use) that I
don't. You may be better off asking in a group about IIS:

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

login failed for user

hi,
i have developed a web application. i need to connect to sqlserver 2000
to fetch data and i am getting the following error when requested for
login page.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
When i refresh the page it is working properly, i.e., i could see the
login screen.
what is the solution for this problem?
KalaivananIt sounds like the web application is trying to connect using the system
account. Give it a user account (non sa) which can logon to the sql server.
Also verify that SQL Server is not running under the local system account.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"kalaivanan" <mail2kalai@.gmail.com> wrote in message
news:1157353804.602345.216230@.i3g2000cwc.googlegroups.com...
> hi,
> i have developed a web application. i need to connect to sqlserver 2000
> to fetch data and i am getting the following error when requested for
> login page.
> Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
> When i refresh the page it is working properly, i.e., i could see the
> login screen.
> what is the solution for this problem?
> Kalaivanan
>

login failed for user

hi,
i have developed a web application. i need to connect to sqlserver 2000
to fetch data and i am getting the following error when requested for
login page.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
When i refresh the page it is working properly, i.e., i could see the
login screen.
what is the solution for this problem?
KalaivananIt sounds like the web application is trying to connect using the system
account. Give it a user account (non sa) which can logon to the sql server.
Also verify that SQL Server is not running under the local system account.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"kalaivanan" <mail2kalai@.gmail.com> wrote in message
news:1157353804.602345.216230@.i3g2000cwc.googlegroups.com...
> hi,
> i have developed a web application. i need to connect to sqlserver 2000
> to fetch data and i am getting the following error when requested for
> login page.
> Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
> When i refresh the page it is working properly, i.e., i could see the
> login screen.
> what is the solution for this problem?
> Kalaivanan
>

login failed for use null

I have an extended web application to MS CRM 3.0 that is simply trying to
populate some values from the filtered views.
I receive an SQL Exception Login failed for user '(null)'. Reason: Not
associated with a trusted SQL Server connection when accessing from client
machines. I do have "Integrated Security=sspi" in the connection string.
It works fine from the MS CRM Server. It works from my desktop only when I
have remote desktop connection to the MS CRM server and opened the extended
application from there.
Does anyone have a solution to this?
Thanks
DevCheck if this applies to you:
http://support.microsoft.com/kb/909509/en-us
"Dev" wrote:
> I have an extended web application to MS CRM 3.0 that is simply trying to
> populate some values from the filtered views.
> I receive an SQL Exception Login failed for user '(null)'. Reason: Not
> associated with a trusted SQL Server connection when accessing from client
> machines. I do have "Integrated Security=sspi" in the connection string.
> It works fine from the MS CRM Server. It works from my desktop only when I
> have remote desktop connection to the MS CRM server and opened the extended
> application from there.
> Does anyone have a solution to this?
> Thanks
> Dev
>

login failed for use null

I have an extended web application to MS CRM 3.0 that is simply trying to
populate some values from the filtered views.
I receive an SQL Exception Login failed for user '(null)'. Reason: Not
associated with a trusted SQL Server connection when accessing from client
machines. I do have "Integrated Security=sspi" in the connection string.
It works fine from the MS CRM Server. It works from my desktop only when I
have remote desktop connection to the MS CRM server and opened the extended
application from there.
Does anyone have a solution to this?
Thanks
DevCheck if this applies to you:
http://support.microsoft.com/kb/909509/en-us
"Dev" wrote:

> I have an extended web application to MS CRM 3.0 that is simply trying to
> populate some values from the filtered views.
> I receive an SQL Exception Login failed for user '(null)'. Reason: Not
> associated with a trusted SQL Server connection when accessing from client
> machines. I do have "Integrated Security=sspi" in the connection string.
> It works fine from the MS CRM Server. It works from my desktop only when I
> have remote desktop connection to the MS CRM server and opened the extende
d
> application from there.
> Does anyone have a solution to this?
> Thanks
> Dev
>sql

Monday, March 19, 2012

Login failed

I have VS2005 Beta 2

I created a very simple Web Site that has a Login page and a Default Page

I installed MSDE so that I can use a SQL 2000 database

I ran C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\aspnet_regsql.exe
to create a database in the MSSQLSERVER for user info.

My Web.config file looks like:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=myDataBase;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="false">
<assemblies>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<authorization>
<deny users="?"></deny>
</authorization>
<authentication mode="Forms"/>
</system.web>
</configuration>


I have a Global.asax file containing:

void Application_Start(Object sender, EventArgs e) {
// always create bob and alice as users if they are not present
// so you can login and we can avoid dealing with admin
//
MembershipCreateStatus status;
if (Membership.FindUsersByName("bob").Count == 0)
Membership.CreateUser("bob", "pass@.word1", "bob@.wingtip.com", "no question", "no answer", true, out status);
if (Membership.FindUsersByName("alice").Count == 0)
Membership.CreateUser("alice", "pass@.word1", "alice@.wingtip.com", "no question", "no answer", true, out status);
}

When open the web site from the File System in VS2005 everything runs fine.

When I copy the Web site to a virtual directory set up in IIS and the open the web site using Local IIS in VS2005 I get:

Cannot open database "myDataBase" requested by the login. The login failed.
Login failed for user 'BARBARA\ASPNET'.


You use integrated security to connect to the database and when testing local in VS2005 it will use the currently logged on user running VS2005. Most likely that is your user account and it has access to the database.

The error message indicates you are trying to logon to the database with BARBARA\ASPNET user and that is the user setup to run the application in IIS. You could either change this to be another user that has access to the database needed, under directory security in IIS, or give the user BARBARA\ASPNET access to the database.|||Thanks for your reply - I don't have that much experience with this stuff -

Could you please tell me how I can go about giving BARBARA\ASPNET access to the database? I don't know about changing the user that is accessing the database in IIS. BARBARA is the name of the computer and ASPNET is the user that was created on the computer when all this stuff was loaded. Do I have to change the database server to use mixed security?

Is it a user that has to be set up for the server or for the database? In any case, I don't really know how to do this. Any direction would be appreciated.

thanks|||You might want to have a look at 3rd party tools to adminstrate MSDE.

You can do it directly in a query also.

exec sp_grantlogin 'BARBARA\ASPNET'
go
use myDataBase
go
exec sp_grantdbaccess 'BARBARA\ASPNET', 'ASPNET'
go
exec sp_addrolemember 'public', 'ASPNET'

This assumes that the group public has the proper permissions in the database. You could use dbo instead of public then the ASPNET user will be acting as database owner.

|||okay thank you very much - that gives me a direction

Login failed

I have VS2005 Beta 2

I created a very simple Web Site that has a Login page and a Default Page

I installed MSDE so that I can use a SQL 2000 database

I ranC:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\aspnet_regsql.exe
to create a database in the MSSQLSERVER for user info.

My Web.config file looks like:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=myDataBase;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="false">
<assemblies>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<authorization>
<deny users="?"></deny>
</authorization>
<authentication mode="Forms"/>
</system.web>
</configuration>


I have a Global.asax file containing:

void Application_Start(Object sender, EventArgs e) {
// always create bob and alice as users if they are not present
// so you can login and we can avoid dealing with admin
//
MembershipCreateStatus status;
if (Membership.FindUsersByName("bob").Count == 0)
Membership.CreateUser("bob", "pass@.word1", "bob@.wingtip.com", "no question", "no answer", true, out status);
if (Membership.FindUsersByName("alice").Count == 0)
Membership.CreateUser("alice", "pass@.word1", "alice@.wingtip.com", "no question", "no answer", true, out status);
}

When open the web site from the File System in VS2005 everything runs fine.

When I copy the Web site to a virtual directory set up in IIS and the open the web site using Local IIS in VS2005 I get:

Cannot open database "myDataBase" requested by the login. The login failed.
Login failed for user 'BARBARA\ASPNET'.


You use integrated security to connect to the database and when testing local in VS2005 it will use the currently logged on user running VS2005. Most likely that is your user account and it has access to the database.

The error message indicates you are trying to logon to the database with BARBARA\ASPNET user and that is the user setup to run the application in IIS. You could either change this to be another user that has access to the database needed, under directory security in IIS, or give the user BARBARA\ASPNET access to the database.|||Thanks for your reply - I don't have that much experience with this stuff -

Could you please tell me how I can go about giving BARBARA\ASPNET access to the database? I don't know about changing the user that is accessing the database in IIS. BARBARA is the name of the computer and ASPNET is the user that was created on the computer when all this stuff was loaded. Do I have to change the database server to use mixed security?

Is it a user that has to be set up for the server or for the database? In any case, I don't really know how to do this. Any direction would be appreciated.

thanks|||You might want to have a look at 3rd party tools to adminstrate MSDE.

You can do it directly in a query also.

exec sp_grantlogin 'BARBARA\ASPNET'
go
use myDataBase
go
exec sp_grantdbaccess 'BARBARA\ASPNET', 'ASPNET'
go
exec sp_addrolemember 'public', 'ASPNET'

This assumes that the group public has the proper permissions in the database. You could use dbo instead of public then the ASPNET user will be acting as database owner.|||okay thank you very much - that gives me a direction

Login failed

Hi,

I can connect to the SQL server installed in another machine in our network. But when I run the web form I'm having this error.

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Pls help me

your sql server to need to setup account for this paticular machine to access.|||

Hi lakmalvbj,

From your description, I understand you can use SQL client tool to connect the remote SQL Server by window authentication, but Web Form fail. If I have misunderstood your concern, please feel free to let me know.

The error message isLogin failed for user ''. The user is not associated with a trusted SQL Server connection.

I find the user name is null. Is it the intact error message?

If the error message is intact. For the user who login fail is null, I believe you were using Impersonation in web.config with simply section:

<identityimpersonate="true" />

When a client view the page with Windows Authentication, the primary token can be passed only once and cannot be used for connecting remove database. So the null user login fail error occured. this is a design feature of NTLM security. And the solution is set username and password in identity section.

<identityimpersonate ="true"username="Domain\UserName"password="pword"/>

Or change the connect string to use SQL authentication.

|||

Hi,

Thanks for all replies.

I solved the problem by creating new user in sql server and giving l user name and password in Connection String. Work fine.

Dim myconnection As SqlConnection = New SqlConnection("workstation id="Ur Work Station";packet size=4096;user id=XXXX;password=XXXX;data source=Server;initial catalog=Database")

This work fine. I tried Benson Yu's suggestions. It also work fine

login failed

I know this is probably a question that has been answered a million times, but it is in regard to SQLEXPRESS. I have built a small ASP 2.0 web app that runs fine on the local production machine when I go to view a gridview or a detailsview to delete or add records. However, when I try the site out on another machine, it runs fine (logins, etc), however when I go to the data page I get an error stating that the login failed for the ASPNET account.

In SQLEXPRESS, where do I set the permission for the ASPNET account, or how do I go about handling this?

Thanks for the information.

BradJust some other information as I have not yet found an answer to this problem - I am using SQLEXPRESS (as stated in the prior post) and IIS 5.1 for other tables. I can using the login controls just fine. I can add users, etc. I created a new database in SQLEXPRESS and it is the tables to this database that I am having a problem with.

Thanks for the help.

Brad|||Okay, the only Express Manager and grant dbo rights to ASPNET. If there is a better way for this, please let me know because I don't know if it is safe to give those rights to this account.

Brad|||Are remote connections enabled for SQL Express? Can you connect remotely at all? You can check if remote connections are enabled using the Surface Area Configuration tool.

What is the login failure error message in the SQL Express error log?

What is the version of SQL Express that you are using?

Thanks
Laurentiu

Monday, March 12, 2012

Login difficulty

I have created a a web application on computer1 and I have now transferred it to computer2. I am trying to attach my database (db1) in VS but I get this error: "Cannot open user default database. Login failed for user: username1". However when I use Management Studio Express I am able to access db1. I'm a newbie on this.

If you are not using the Advanced version of Express uninstall the current one and install the Advanced because it comes with Management Studio that will help with the above problem. Hope this helps.

http://msdn.microsoft.com/vstudio/express/sql/download/

|||

By default, SQL Server is 'closed' to remote connections.

You will need to configure the server to allow remote connections. These sources will guide you.

Configuration -Configure SQL Server 2005 to allow remote connections
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

Configuration -Connect to SQL Express from "downlevel clients"
http://blogs.msdn.com/sqlexpress/archive/2004/07/23/192044.aspx

Configuration -Connect to SQL Express and ‘Stay Connected’
http://betav.com/blog/billva/2006/06/getting_and_staying_connected.html

Configuration - Guideline for Connectivity Question Posting
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362498&SiteID=1

|||if you specified a non-exisiting database as the default database for the user or the user does not h ave access to his default database, then you probably will get this error message. So check if the has the appropiate permissions to access his default user database or change the default database using the GUI or using the TSQL command sp_defaultdb.

Jens K. Suessmeyer.

http://www.sqlserver2005.de