Search code examples
asp.net-mvcvisual-studio-2022

Microsoft.Data.SqlClient.SqlException: 'Failed to generate SSPI context.' but it works sometimes


So as mentioned, when I first start my computer and open up my VS and project. I then click the start of the project and it works just fine. If I add an element to an HTML file I can sometimes just hot reload and it works. If I add something as simple as a console.writeline and save then restart I would get this, or I need to restart this if I add more than one thing to an HTML file and I get this issue. I shut down VS and then sometimes I need to restart my computer and it works just fine. Why does this happen.


Solution

  • I don't know what the real solution is but what I did to fix this was deleted my database and migrations. I added a new migration and update-database and it worked. I was hoping there was a better solution before I did this but I could not find the answer.