0

I am working on an ASP.NET 4.8 project that has been running for 15 years. It always used a standalone sql server (recently upgraded from MSSQL2008 to MSSQL2019). For some time now - strangely - the application reports a network-related or instance-specific error if you try to log in with a nonexistent username. To log in we employ Forms Authentication with a custom login screen (username/password), validating the credentials and setting the auth cookie data.

When the credentials check out, the user is being redirected to it's desired page. If credentials fail, the system used to wait a few seconds presenting the login screen again. But recently, instead, we get said error after 30 seconds or so.

The connection strings are all in order, they worked well all of the time. The stacktrace has only non-user-code and lists a call to System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(...). I think this relates to the system for some reason trying to create a localDb. Nothing in our code uses localDb, we never did.

I wonder how I can find out more about that problem. Where does localDb come from and how can I get rid of it?

Thank you all very much for any ideas or insight.

Update I'm still desparate to find out why the system tries to Create an MDF file.

Below is the error information.

URL: http://localhost:56900/Shared/Login.aspx?ReturnUrl=/Vertraege.aspx

Stacktrace:

bei System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
bei System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
bei System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString)
bei System.Web.DataAccess.SqlConnectionHelper.**CreateMdfFile**(String fullFileName, String dataDir, String connectionString)

Error Message: Keine Verbindung mit der SQL Server-Datenbank. (no connection to sql server)

Connection String in web.config:configuration/connectionStrings:

<add name="connectionname" connectionString="Data Source=tcp:10.0.0.2,1433;Initial Catalog=catalog;User ID=username;Password=secret;application name=appname" providerName="System.Data.SqlClient" />
Jens Mander
  • 430
  • 7
  • 15
  • How do you publish the visual studio project? If you use visual studio to publish it then you will see an sql connections tab in the publishing menu, see if the default connection is changed with some local connections. – Jamshaid K. Sep 25 '20 at 21:18
  • The error occurs when I run it in the debugger as well as when published to our test server. I publish it to the file system using the publishing wizzard. – Jens Mander Sep 25 '20 at 21:20
  • 1
    please paste the exception text in the question to understand what happens – henoc salinas Sep 25 '20 at 22:02
  • Any clues in [MVC4: UserIsInRole - Unable to connect to SQL Server database](https://stackoverflow.com/questions/14521003/mvc4-userisinrole-unable-to-connect-to-sql-server-database)? – AlwaysLearning Sep 26 '20 at 07:08

0 Answers0