[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

No Database connection after uploading site

Posted on 2015-01-26
12
Medium Priority
?
244 Views
Last Modified: 2015-01-27
Using VS 2013, after I ftp the site to the server, there is a problem with the database.  See error message below.
PS: Does it make a difference if I FTP or Publish?


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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)
  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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)

Source Error:



Line 22:             ' Validate the user password
Line 23:             Dim manager = New UserManager()
Line 24:             Dim user As ApplicationUser = manager.Find(UserName.Text, Password.Text)
Line 25:             If user IsNot Nothing Then
Line 26:                 IdentityHelper.SignIn(manager, user, RememberMe.Checked)
0
Comment
Question by:rrhandle8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 40571469
"The server was not found or was not accessible."
Well there's your problem.

I take it the database server you have configured prior to pushing up the site should be available once the site is established?  I would double-check that.
0
 

Author Comment

by:rrhandle8
ID: 40571482
The database is there.

Databases.png
0
 

Author Comment

by:rrhandle8
ID: 40571489
Here are the connection strings.

It is the Willowlane database I am trying to use.

The other database is an unknown at this time.  It belongs to a 3rd-party application I will get to later.

 <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WillowLane1-f59c4ece-32dd-40f4-9451-1620648a0486;AttachDbFilename=|DataDirectory|\aspnet-WillowLane1-f59c4ece-32dd-40f4-9451-1620648a0486.mdf;Integrated Security=SSPI"
      providerName="System.Data.SqlClient" />
    <add name="DatabaseConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 40571490
what is your sql config setting in the servers web.config
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 40571497
(LocalDb)\v11
what does the website provider say about sql connection strings.. do they support localdb?
0
 

Author Comment

by:rrhandle8
ID: 40571571
Just noticed I am using .NET 4.5, but the server has .NET 4.0.  Could that be the problem?
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 40571676
could be part of it but probably more to do with the sql connection settings
if you publish it to azure does it work?
0
 

Author Comment

by:rrhandle8
ID: 40571828
Don't know. Don't have an account.

website provider says I need to have a separate Web.config file, and use the IP address in place of localdb.  Tried that, but got another error:


Invalid value for key 'attachdbfilename'.
  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.ArgumentException: Invalid value for key 'attachdbfilename'.

Source Error:



Line 12:     Inherits IdentityDbContext(Of ApplicationUser)
Line 13:     Public Sub New()
Line 14:         MyBase.New("DefaultConnection")
Line 15:     End Sub
Line 16: End Class
0
 
LVL 83

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 40571852
you need to add the credentials to your web config and not use Integrated Security=SSPI

i.e. from godaddy
<connectionStrings>

<add name="Personal" connectionString=" Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False" providerName="System.Data.SqlClient" /> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString=" Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False" providerName="System.Data.SqlClient" />

</connectionStrings>
0
 

Author Comment

by:rrhandle8
ID: 40571879
So I will need to maintain two separate web.config files?
BTW: When I created the database, I used Visual Studio 2013 to create it.  It never asked me for a username and password.  I am use to connecting to a database on the server.  First time I ever used VS to create the database.  How can I assign a username and password to the database?
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 40572009
you have to maintain 2 web.config 1 for local and 1 for on the webserver (since you don't control it)
0
 

Author Comment

by:rrhandle8
ID: 40572405
Thanks, David. You got me past the error. Unfortunately, my login attempts are failing.

In the example you sent, I see you are removing LocalSqlServer, then adding it back. The connection string Personal and LocalSqlServer are both the same. Could you be so kind as to explain that, or send me to an explanation on-line?


<add name="Personal" connectionString=" Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False" providerName="System.Data.SqlClient" /> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString=" Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False" providerName="System.Data.SqlClient" />
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question