-2

Possible Duplicate:
A network-related or instance-specific error occurred while establishing a connection to SQL Server.

Today i have create two pages login.aspx using LOgin control and register.aspx using Create user wizard ...

when i use connection string of my production server in my local computer then site works only if my database ASPNETDB.MDF is present in APP_Data Folder in my local computer..

if i rename ASPNETDB.MDF or Delete ASPNETDB.MDF from my local compuet App_Data the the following error occurs ...

An attempt to attach an auto-named database for file C:\Users\Ashish Dobriyal\Documents\Visual Studio 2008\WebSites\VOLVOO\App_Data\ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. 

but

After i publish my webpages ..... and database to my production server .... it produces an 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)

What was the problem actually ... ??

MY PRODUCTION SERVER CONNECTION STRING :

<connectionStrings>
    <remove name="ConnectionString"/>
        <add name="ConnectionString" connectionString="workstation id=volvobusesindia.mssql.somee.com;packet size=4096;user id=username;pwd=password;data source=dobriyal.mssql.somee.com;persist security info=False;initial catalog=dobriyal" providerName="System.Data.SqlClient"/>
  </connectionStrings>

MY LOCAL SERVER CONNECTION STRING :

<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
Community
  • 1
  • 1
ClixNCash
  • 81
  • 1
  • 4
  • 14
  • post yout connection strings please! Both: production and development – user492238 Jan 20 '11 at 08:18
  • 2
    You keep asking basically the same question over and over again - please stop! – marc_s Jan 20 '11 at 08:29
  • My problem cannot be solved ... – ClixNCash Jan 20 '11 at 08:32
  • 1
    it can be solved. but asking the question **over and over again** only frustrates the community. ask the question once. if you haven't found a solution, bump your question with updates on where your at. we are not your loyal servants. – RPM1984 Jan 20 '11 at 09:26

1 Answers1

0

when i use connection string of my production server in my local computer then site works only if my database ASPNETDB.MDF is present in APP_Data Folder in my local computer..

This is because you need to add access permissions to the directory that you going to put the database. The permissions must be for the user that runs the asp.net pool that you using.

Alternative try this string, for both production and local server and just be sure that your database have the correct permissions for been access from the asp.net running pool account. This is not depended from what you write on the string but from how you correctly setup the database. Its working 100% so if not play for you search the database permissions, both file and database settings.

<connectionStrings>    
            <add name="ConnectionString" connectionString="Data Source=localhost;Initial Catalog=dobriyal;Integrated Security=True;" providerName="System.Data.SqlClient" />   
</connectionStrings>   
Aristos
  • 66,005
  • 16
  • 114
  • 150