❔ SQL Error
I created the models, generated the controllers and views for each with the basic index, create, remove functions.
I added a link to view the index for one of the models I have created:
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Contract" asp-action="Index">Contracts</a>
</li>
</ul>
where it link to the index action in the model "Contract".
However, I get this error when clicking on Contract:
An unhandled exception occurred while processing the request.
Win32Exception: The system cannot find the file specified.
Unknown location
SqlException: 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: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
I tried turning off windows firewall.
I also have .net 7.0
If there is any other info you guys need, lmk
4 Replies
I'm not sure what info we can provide that isn't right there in the exception
your app is failing to connect to SQL Server
check your sql drivers for the connection.
open server viewer in VS. try connect to your sql.
check your connection string.
do this i reversed order.
You also didn't post any code that actually has anything to do with the database
Show us how you connect with it maybe, how you make your queries, etc
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.