Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every body

I'm trying to develop multi client in C# with SQL Server 2008 data Base, after made setup file and install it to client I cannot access DataBase in server. I used LINQ to Connect DataBase and have App.config xml file in my project which ConnectionString Declare there and I after installing the application I change that XML file's ConnectionString to right way(Server name and sql instance name), but this change doesn't have any impact, whats the problem maybe have my solution?
If any one has experience about developing multi client application share with me.
and also How can I change scope in project properties from Application to User, It's may be solve my problem

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
HTML
************** Exception Text ************** 
System.Data.SqlClient.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)
 at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
 at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
 at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
 at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
 at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
 at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
 at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
 at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
 at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()
 at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
 at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
 at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
 at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
 at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
 at System.Linq.Queryable.Count[TSource](IQueryable`1 source) at ISPManagement.frmLogin.YidNvNcopC(Object , EventArgs ) at System.Windows.Forms.Control.OnClick(EventArgs e) at DevComponents.DotNetBar.ButtonX.PerformClick()
 at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
 at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
 at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
 at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg) 
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg) 
************** Loaded Assemblies ************** 
 mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.237 (RTMGDR.030


Thank you
Posted
Updated 8-Sep-12 8:04am
v2
Comments
[no name] 8-Sep-12 13:17pm    
There is not nearly enough information to make a guess. "I cannot access DataBase in server", why not? Can you ping the server? Is the server on the LAN/WAN? Is there a firewall? Is the firewall configured to allow connections? Any errors? What errors? Server configured to allow remote connections?
aghapour.ahad 8-Sep-12 13:28pm    
Thank you for quick answer. Yes I can ping the server and my fire wall is off.
and I can see my dataBase in which Clients have SqlServer. But when I'm Ammend App.config.exe file beside the exe file, there is no effect my application.
Philip Stuyck 8-Sep-12 13:54pm    
What are the error messages ?
Connection strings are always application specific and never user specific btw.
aghapour.ahad 8-Sep-12 14:01pm    
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.SqlClient.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)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at ISPManagement.frmLogin.YidNvNcopC(Object , EventArgs )
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevComponents.DotNetBar.ButtonX.PerformClick()
at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.237 (RTMGDR.030
Herman<T>.Instance 10-Sep-12 7:43am    
what are the settings of de db when yiou look in Sql Server Configuraion manager.

Do you use an express version on your DEV system and a full version on your production server?

1 solution

When you change the app.config, restart app to verify changes. Try pinging the server from the where the app is being installed. Check firewall settings. shared network. Use your new connection string on your development machine on the same network if local.
VB
0 down vote unaccept


If the error mentions "provider: Named Pipes Provider", then your application is trying to connect via named pipes to your SQL Server, is that what you want? You can prefix the server name with tcp: to force TCP/IP usage instead i.e. Server=tcp:ServerName if you wish to use TCP.

If you want to use named pipes it is possible that support for it is turned off on the server, I believe it is disabled by default. You would need to enable it via the SQL Server configuration manager program on the server, in the network configuration, protocols section

.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900