Showing posts with label specified. Show all posts
Showing posts with label specified. Show all posts

Thursday, February 9, 2012

(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

ASP v2.0

I am getting this error when attempting to sign in to my site once uploaded to the server. Can anyone help me to resolve this error?

Server Error in '/' Application.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

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): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735091
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
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) +130
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



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

First, this stack trace is really useless for diagnosing your problem. Here's some questions to get you started.

What's your connection string? Are you using integrated security?

Does the SQL Server sit on the same machine as the web server? Is it part of the same domain?

Is the sql server behind a firewall? Can the web server "see" the SQL Server?

Does this work on your machine with the same username/password?

Can you log into the Web Server via remote desktop? If so can you ping the SQL Server? Can you connect using Query Analyzer?

|||I'm using the integrated security within ASPv2.0.

The issue comes up with the login on the server.

I can sign in on the development PC and everything runs fine, but I receive this error when I attempt to log on after I upload the site to the server.

I am not sure where the connection string is for v2.0 integrated security. I have just recently moved from v1.1 and am still discovering new things as I go.

I use Godaddy.com web hosting. So the server and the development PCs are separate. I have been using the Publish Web Site tool in VS2005 and then CuteFTP Pro to transfer the files. I have configured my godaddy account to accept v2.0 framework and activated the SQL server schema.

I have found that a test non-member page is having difficulty connecting to the access database I am using. It gives me an error stating "c:\access_db\Survey.mdb is not a valid location..." <-- something of that nature. Using the following connection string for this:
strConn = New OleDbConnection(String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\access_db\Survey.mdb"))

I am not sure if that is caused by the same issue or if it is because of my connection string. I assume it is a connection string issue. It works fine on my development pc even though my hard drive is e: not c:, so I don't know what's up with that really. still working on it.|||

OK. Let's back up. Are you using Access, or MS SQL Server? If you're using Access, why are you posting to a SQL Server forum?

|||I apologize I am not trying to be confusing.

My issue that I posted here for is for the SQLSever database: ASPNETDB.MDF

This is where I am getting the issue from. The Access DB is an issue I think I can handle on my own at this time. I shouldn't have mentioned it.|||

So you're trying to mount this file, which is sitting on the same computer as the web server, right? And you're using integrated security, right? I believe that integrated security requires that the user have a Windows login to the box/domain that the app's running on. I'm not sure how you're doing that with your web app.

If you're developing using VS 2005, there's a lot that your app can do (because it's running under your credentials) that it can't do on a production server.

If you have a MSDN subscription, you might want to build a test Windows 2003 server using VirtualPC, and try deploying your app there. That'll give you a better feel for what's going on with the GDaddy box.(I did that last week to diagnose problems with a web service on a server running multiple web servers. It turns out using localhost doesn't always work.)

|||The web server is a completely different PC than my development. I am uploading the files to the server using CuteFTP Pro.GoDaddy.com owns the server.

I have setup my application to use internet secruity (see jpg). It should not require a Windows login. I do not have an MSDN subscription, so I cannot use a test server using VirtualPC.

|||Does the application require the user to log in? If so, how are you passing the user id/pw to the database?|||I am using the Login control in ASP.NET v2.0

I am not sure how it passes the username/password to the database. It all happens behind the scenes.|||Well, we've pretty much hit the limits of how I can help you. If you figure it out, try to post the answer in case someone else has a similar problem.|||I appreciate your attempt. Thank you for using your time to help me.

If anyone else has discovered a solution please reply. I will do the same.

Thank you|||

I have the EXACT same problem...Godaddy hosting trying to use SQLEXPRESS database file that is included with visual web designer.

Problem is... it won't work. According to Microsoft. (If Godaddy hostsmultiple sites that do not trust each other) The note below was taken from the msdn site.I underlined what I believe is the cause of your problem.

The resolution is to use plain old connection strings to plain old SQL server database instances.

good luck

NoteNote

If you are deploying your SQL Server Express Edition database to a Web server that hosts multiple sites that do not trust each other, then you cannot use file-based connections or user instances to help ensure that your data is not exposed to other applications on the server. In this case, it is recommended that you migrate the contents your SQL Server Express Edition database to another version of SQL Server 2005 that your deployed ASP.NET application can access.

http://msdn2.microsoft.com/en-us/library/ms247257.aspx|||One solution I am curious about is this:

With Godaddy, you must use your host manager in order to set up the site to use Framework v2.0 and to use SQL Server. When it sets this up it creates a few files--
(2) Folder -- "_private" and "_vti_log"
(1) HTML File -- "_vti_inf.html"
(1) Asp file -- "gdform.asp"

-- I am not sure why these files are created or what they are used for. They may have something to do with this issue.

-- When you set up the server to enable using an MS Access Db, it creates a folder called "access_db." I think what it is doing is creating virtual folders to run off of. If you create your own folder on the server usinf FTP and place an access db file inside, you are not able to access the db. But if you place the db inside the "access_db" folder that GoDaddy creates, everything works fine.

-- The solution may be in figuring out the setup here. I am going to give GoDaddy a call and see if they are familiar with this issue and have a solution.

-- If there is a way to change the connection string that v2.0 uses to connect to that user db, then it may be ab easier solution. So far I have not found a way to change the connection string for the user db within v2.0.