I have a simple web app that interacts with a Microsoft SQL Server 2016 Standard Edition that is hosted on it's own server, in the same environment. When I run the app locally, it connects just fine and posts to the DB with no problem. After I published the app to our app hosting server I get the following error:
error: 52 - Unable to locate a Local Database Runtime installation.
I'm wondering why it is even talking about a local database when I am connected to a DB on a server, which was initially working. I know the connectionString works because it connects to the DB and posts just fine from localhost.
<connectionStrings> <add name="PickemContext" connectionString="Data Source=ISSQLTEST01; user id=pickem; Password=pickem" providerName="System.Data.SqlClient" /> </connectionStrings>
Here is the error.
The system cannot find the file specified Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [Win32Exception (0x80004005): The system cannot find the file specified] [SqlException (0x80131904): 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: 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.)]
And it keeps going with more stuff in the stack trace.
How can I go about troubleshooting this? Its confusing to me that it works and posts to the DB just fine from localhost but throws an error talking about localDBs when trying to post from the hosted app. When looking at the table data displayed on the hosted app, it loads everything in fine, all the data that's in this table. The problem just seems to be with posting.
Ok I fixed the issue. The issue was not my connection string in Web.config. When I was making the app, I had to add some functionality to the Create method in the controller, and I had set a "conString" String variable because parts of this method needed the connectionString. This variable was still holding the original connectionString which points to a localDB. I just replaced that with the proper connectionString and now it is all good.
User contributions licensed under CC BY-SA 3.0