How to connect a localdb from Visual Studio to the published Azure web app?

两盒软妹~` 提交于 2019-12-29 09:18:36

问题


So i have a localdb set up for my project in Visual Studio but when I publish it to my Azure web app, I get "

An unhandled exception occurred while processing the request. Win32Exception: The system canot find the file specified TryGetConnection"

I tried adding a "DefaultConnection" Connection String with the database/server as the value in the Web App settings but that didn't do anything


回答1:


LocalDb doesn't exist for Azure. LocalDb is a feature of SQL Server Express, there is no equivalency of that on the service (machine) you are deploying your App Service website on.

There are plenty of options instead of LocalDb when you go to Azure. The easiest (and recommended) is to use an Azure SQL database and replace your connectionstring with one that points to that instead when you publish your website.

Some other options are discussed here Using a LocalDb MDF file on Azure



来源:https://stackoverflow.com/questions/42060346/how-to-connect-a-localdb-from-visual-studio-to-the-published-azure-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!