Solved

Error with ASP.NET 2.0 page running a linked server query

Posted on 2007-11-14
10
314 Views
Last Modified: 2011-09-20
I have a query i want to run via my asp webpage. It runs fine in SQL Server 2005. It's based on a linked server. However when I tried to throw this query up in ASP. I get the following error. I need someone to help me figure out what this means in plain engrish. I don't really know what to do...

The OLE DB provider "SQLNCLI" for linked server "IN-MMGE-CELLLAB" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "SQLNCLI" for linked server "IN-MMGE-CELLLAB".

Stack Trace:


[SqlException (0x80131904): The OLE DB provider "SQLNCLI" for linked server "IN-MMGE-CELLLAB" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "SQLNCLI" for linked server "IN-MMGE-CELLLAB".]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +862234
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739110
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
   System.Data.SqlClient.SqlDataReader.get_MetaData() +62
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +141
   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.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +41
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

 
0
Comment
Question by:edi77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 500 total points
ID: 20284044
I don't think the problem is because you're using a linked server, it's a problem with the connection string, does your connection string include a username/password with access to the db server?
0
 

Author Comment

by:edi77
ID: 20284092
no i think its using the same connection string i used for other tables in the website. how would the syntax look?
0
 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 500 total points
ID: 20284180
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 500 total points
ID: 20284201
0
 

Author Comment

by:edi77
ID: 20284314
you meanthe connection string  from asp to the query right because the query works between the linked sql server instances
0
 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 500 total points
ID: 20288565
>>you meanthe connection string  from asp to the query right

yes, because if you're using sql2005 management studio, you're logging into the db servers with either your windows username/password (in which case the app is not using the same) or a username/password that exists in the db servers (which should be part of your app's conn string)...
0
 

Author Comment

by:edi77
ID: 20289333
but im using windows authentication so im logging into the app with my network password.

so i cant put that in the connection string for everyone who will use the app....

how would that look? not sure exactly what you mean can u give me an example of the syntax in the connection string u mean?
0
 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 500 total points
ID: 20289410
>>but im using windows authentication so im logging into the app with my network password
That gets you into the application, but unless you are using impersonation, the app is still using the default account NETWORK SERVICE (IIS6), if lower version of IIS, it's using the account ASPNET.
So when the app communicates with other servers (like the DB server) it is using one of those accounts.
Usually what I do, is create a user on the DB server(s) called "webapps" and then any connection string a web app(s) uses, I use the username and password for the "webapps" db account.
What connectionstring do you have currently?
0
 

Author Comment

by:edi77
ID: 20289899
ok i actually am using impersonation actually.  do u use windows authentication? or forms when you create your webapps person? cuz im using windows auth.

can u show me an example of the syntax u use for your conn string?

all i did for my connection string was use gridview and bind the query(view) using the same connection string i set for the rest of the tables and in the web config. of course these others are not using a linked server.

this is what my web config looks like
<connectionStrings>
  <add name="TestADNIConnectionString" connectionString="Data Source=IN-MMGE-HLOWRLD;Initial Catalog=TestADNI;Integrated Security=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
      <system.web>
              
  <roleManager enabled="false" />
            <identity impersonate="true"/>
  <customErrors mode="Off"/>


            <compilation debug="true"/>
            <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
      
            <authentication mode="Windows"/>
            <authorization>
            
                  <allow roles="ADS\In-mmge-hd-admins"/>
                  <allow roles="ADS\In-mmge-hd-users"/>
                  
                  <deny users="*"/>
                  
            </authorization>
0
 

Accepted Solution

by:
edi77 earned 0 total points
ID: 20289905
ok i actually am using impersonation actually.  do u use windows authentication? or forms when you create your webapps person? cuz im using windows auth.

can u show me an example of the syntax u use for your conn string?

all i did for my connection string was use gridview and bind the query(view) using the same connection string i set for the rest of the tables and in the web config. of course these others are not using a linked server.

this is what my web config looks like
<connectionStrings>
  <add name="TestADNIConnectionString" connectionString="Data Source=IN-MMGE-HLOWRLD;Initial Catalog=TestADNI;Integrated Security=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
      <system.web>
              
  <roleManager enabled="false" />
            <identity impersonate="true"/>
  <customErrors mode="Off"/>


            <compilation debug="true"/>
            <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
      
            <authentication mode="Windows"/>
            <authorization>
            
                  <allow roles="ADS\In-mmge-hd-admins"/>
                  <allow roles="ADS\In-mmge-hd-users"/>
                  
                  <deny users="*"/>
                  
            </authorization>
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question