Asked by:
error 26 when deployed, but works in vs2010

Question
-
User159475415 posted
Hi,
I have a web app that has 2 connection strings one for application database and one for the applicationServices security database. Everything works ok when i build the appliaction and run using vs2010, but when i deploy to the sevre there are issues when i try to access on of the fomrs. Initailly i get the login page which works, but then when it trys to use the other connection string it says error 26 its can't find the server. Heres the error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
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): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +270 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +5023255 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126 System.Data.SqlClient.SqlConnection.Open() +125 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82 [HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +27 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395
I can't understand why it would work when i run locally, but not on the server. Any Ideas here are the connection strings@
<
add name="ApplicationServices" connectionString="Data Source=myServer;Initial Catalog=mySecurityDatabase;Persist Security Info=True;User ID=myUser;Password=MyPassword" providerName="System.Data.SqlClient"/>
<
add name="myConnectionstring" connectionString="Data Source=myServer;Initial Catalog=myAppDatabasePersist Security Info=True;User ID=myUser;Password=MyPassword" providerName="System.Data.SqlClient"/>
They both use the same server same user and same password (is this an issue), but one points at the asp.net security database the other at a database i created. Anyone any ideas what could cause this and how to recitify or even debug as I'm getting no-where.
Monday, July 29, 2013 1:49 AM
All replies
-
User1751268424 posted
Hi,
There is nothing wrong with your VS2010. This is about your access authority to your SQL Server.
You can use your VS2010 to connect directly between your computer and your SQL Server to make sure that you have the authority. Check your firewall, also you need to enable "Named Pipes" and "TCP/IP" using "SQL Server Configuration Manager".
Have fun
Monday, July 29, 2013 2:22 AM -
User516094431 posted
Check below links:
http://forums.asp.net/t/1487146.aspx/1
http://www.codeproject.com/Questions/310806/provider-SQL-Network-Interfaces-error-26-Error-Loc
Monday, July 29, 2013 2:28 AM -
User159475415 posted
Hi,
Yes the vs2010 is fine. Its when i deploy to the server it isn't working? We have several appliactions on the server, but this is the first using the asp security database. I wondered whether it was that or not. The access to the server can't be the reason can it as both connection strings are using the same user & pwd albeit to different databases. adn why would it work when debugging in vs2010 if the account didn't hev the relevant permissions to the databases? It can't b firewall or the login using forms auth wouldn't work to the security database as the databse is on the same server as the appliaction database. Any other ideas anyone?
Monday, July 29, 2013 2:29 AM