I know this is a bit vague, but I'm not being able to pinpoint the issue.
When I run the a bit of code against a local database it runs fine. When I use a remote database I get an error. It occurs midway of the program execution. The DBup upgrade runs, and then a manual query fails with this exception:
System.Data.SqlClient.SqlException (0x80131904): Resetting the connection results in a different state than the initial login. The login fails. Login failed for user 'sa'.
I'm creating SqlConnection
manually using new SqlConnection()
and I'm also using DbUp
I'm not sure what I can be doing wrong. Nor where to start debugging this.
The ConnectionString
does not change and I'm always using sa
to connect to the database.
A good question to start is What does "Resetting the connection" mean? How am I doing it?
After a couple of hours of trial and error I got to a minimal piece of code that reproduces the error
The full stacktrace is
If I change the first
Run(dbName...
toRun("master"...
it runs fine. So it's related to runningALTER DATABASE
in the context of the same database