views:

140

answers:

0

I have a really strange scenerio

I have a smartclient application and an asp.net webapplication which accesses a set of same WCF services.I have a web.config file in my servicehost project which is like this.Database is on client end and we use VPN to connect to it.

 <add name="ConnectionProperty" connectionString="server=192.168.0.12\Sqlserver2005;database=OA_OPTGB_0423;user id=sa;password=***;min pool size=20;max pool size=20;Connection Timeout=30;" providerName="System.Data.SqlClient"/>

I am able to connect to the database and everything works fine from my smartclient.

When i use the same connectionstring in asp.net application,I am not able to connect to this database and i am getting the following 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I am doing this because my authentication is not service based,So i have to connect to the database directly instead of going thru the services layer.

I took backup of the database locally and didauthentication from local database instead of remote one and all other things using services layer with the same connection string.IT works very well.

I donot understand where is the problem.Why Asp.net application is not able to access the database directly and why it is able to access it thru services layer.Please help.