none
A network related or instance specific error

    Pregunta

  • Dear All, I tried every thing to resolve this issue but :(

    Sql server 2008 r2 running on our server (TCP is enabled on port 1433, named pipes are enabled) no firewall enabled 

    on our development system when we try to access sqlserver from Management studio or server explorer i can access it but when i run my application from IIS on my development system its giving me this error 

    Server error in '/' application

    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: Named pipes provider, error:40 - could not open a connection to sql server)

    any suggestions.

    miércoles, 12 de diciembre de 2012 18:38

Respuestas

  • First of all, the setup for SQL Server could be an issue. 

    Forget that for moment, try the following approach.

    Create a new project in VS. Using server explorer, attach/ link SQL Server to peroject. When prompted save connection string.

    This will give if you are missing in your current connection string.

    HIH.


    Mohammad Saidul Karim

    viernes, 14 de diciembre de 2012 4:58
  • There are many reasons of SQL server connectivity issue. But I have setup an small checklist that helps me most of the time to find out the real cause of connectivity issue. Try & share the details.

    1. Check SQL services are running

    2. Check SQL Browser service is running

    3. Check remote connections are enabled

    4. Network connectivity between database & application servers by TRACERT command

    5. Check TCP/IP protocol enabled at SQL server

    6. Check talent connectivity – telnet <IP address> <port no on SQL server running>

    7. Check UDP port 1434 is open or not on SQL Server

    8. Check firewall is running or not Check

    9. If firewall running, SQL Server & UDP port must be added in exception in firewall

    http://mssqlfun.com/2012/09/28/check-list-for-sql-server-connectivity-issue/

    Regards,
    Rohit Garg
    (My Blog)
    This posting is provided with no warranties and confers no rights.
    Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

    miércoles, 19 de diciembre de 2012 16:36

Todas las respuestas

  • Does it work from development server?

    telnet servername 1433



    miércoles, 12 de diciembre de 2012 22:59
  • yes when I execute this command its shows a blank command window with a blinking curson.

    This is the error I am receiving.

    Server Error in '/' Application.

    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    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: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Source Error: 


    Line 61:         {
    Line 62:             var query = _taskRepository.Table;
    Line 63:             query = query.OrderByDescending(t => t.Seconds);
    Line 64: 
    Line 65:             var tasks = query.ToList();

    Source File: .\Services\Tasks\ScheduleTaskService.cs    Line: 63 

    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6351920
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
       System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +6366506
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +180
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +6366917
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6366793
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +352
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +831
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6368598
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +78
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +2194
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6372110
       System.Data.SqlClient.SqlConnection.Open() +300
       System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +132
       System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +3981391
       System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +10513049
       System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +44

    [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
       System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +11121429
       System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +48

    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
       System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +242
       System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +82
       System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +88
       System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +221
       System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +508
       System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +26
       System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +72
       System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
       System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +44
       System.Linq.Queryable.OrderByDescending(IQueryable`1 source, Expression`1 keySelector) +135
       FlatNav.Services.Tasks.ScheduleTaskService.GetAllTasks() in D:\oldsmokes.flatnav\FlatNav.Services\Tasks\ScheduleTaskService.cs:63
       FlatNav.Services.Tasks.TaskManager.Initialize() in D:\oldsmokes.flatnav\FlatNav.Services\Tasks\TaskManager.cs:40
       FlatNavMVC.MvcApplication.Application_Start() in D:\oldsmokes.flatnav\FlatNavMVC\Global.asax.cs:50

    [HttpException (0x80004005): An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
       System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4057141
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

    [HttpException (0x80004005): An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 



    Fs


    • Editado Faisal.s jueves, 13 de diciembre de 2012 0:12
    miércoles, 12 de diciembre de 2012 23:59
  • First of all, the setup for SQL Server could be an issue. 

    Forget that for moment, try the following approach.

    Create a new project in VS. Using server explorer, attach/ link SQL Server to peroject. When prompted save connection string.

    This will give if you are missing in your current connection string.

    HIH.


    Mohammad Saidul Karim

    viernes, 14 de diciembre de 2012 4:58
  • There are many reasons of SQL server connectivity issue. But I have setup an small checklist that helps me most of the time to find out the real cause of connectivity issue. Try & share the details.

    1. Check SQL services are running

    2. Check SQL Browser service is running

    3. Check remote connections are enabled

    4. Network connectivity between database & application servers by TRACERT command

    5. Check TCP/IP protocol enabled at SQL server

    6. Check talent connectivity – telnet <IP address> <port no on SQL server running>

    7. Check UDP port 1434 is open or not on SQL Server

    8. Check firewall is running or not Check

    9. If firewall running, SQL Server & UDP port must be added in exception in firewall

    http://mssqlfun.com/2012/09/28/check-list-for-sql-server-connectivity-issue/

    Regards,
    Rohit Garg
    (My Blog)
    This posting is provided with no warranties and confers no rights.
    Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

    miércoles, 19 de diciembre de 2012 16:36