TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Søren Christensen
NA
6
2.1k
Website will only connect to local host database?
Oct 6 2018 3:40 PM
Hi
Hope someone can help me.
All of the sudden my MVC project won't start locally, or when it is deployed. It seems as though it is expecting the database på local and not in Azure as it is.
Looking in Web.config everything looks correct - defaultConnection points to my Azure SQL db, but when it starts I get the error below.
I cannot remember installing any new updates or references lately.
Can someone guide me in the right direction?
I've tried the following:
- added "
<
clear
/>
" in web.config just before the connection string (resulted in different error)
- Looking for wrong imports in Startup.Auth.cs (found in another post)
I see a machine.config which has the wrong connection string, but unsure when that file is created, and from where it gets it's information.
[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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +1370
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +679
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +57
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1142
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +312
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +126
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +255
System.Data.SqlClient.SqlConnection.Open() +128
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +79
[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +169
System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +118
System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +56
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +451
Thanks in advance
Reply
Answers (
1
)
Asp.net MVC FileUpload
I Have an Issue MVC project In view,? I will explain in