I'm using SQL Server 2012, and when I publish my application, both on the client server and on my pc everything works fine. The connection strings
for DB is correct, everything looks fine. Now where's the problem? When trying to authenticate a user I get the 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: 50 - Local Database Runtime error occurred. )
In my AuthConfig.cs I have:
WebSecurity.InitializeDatabaseConnection("Server=" + ConfigurationManager.AppSettings["Server"] + ";Database=" + ConfigurationManager.AppSettings["Database"] + ";Integrated Security=False;User ID=" + ConfigurationManager.AppSettings["UserID"] + ";Password=" + ConfigurationManager.AppSettings["Password"] + ";MultipleActiveResultSets=true;",
"System.Data.SqlClient", "Users", "UserId", "UserName", autoCreateTables: true);
Where do I get the Data ( Server , Database , UserID and Password ) from my Web.config
Web.config :
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcTesteLayout-20131023143453;Integrated Security=False;AttachDBFilename=|DataDirectory|\aspnet-MvcTesteLayout-20131023143453.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="Server" value="CPSI0024\SQLEXPRESS" />
<add key="Database" value="OleoTorres" />
<add key="UserID" value="OleoTorres" />
<add key="Password" value="oleotorres" />
<add key="ServerArtSoft" value="OLEOTORRES2014" />
<add key="UserServerArtSoft" value="Admin" />
<add key="PassServerArtSoft" value="passServ" />
<add key="pathFiles" value="D:/uploadsOleotorres"></add>
<add key="pathFilesGerarPDF" value="D:/gerarPDFOleotorres"></add>
</appSettings>
I've already tried several ways to solve it, but I could not find a solution where I could solve the problem ...