How to connect a localdb from Visual Studio to the published Azure web app?(如何将本地数据库从 Visual Studio 连接到已发布的 Azure Web 应用程序?)
问题描述
所以我在 Visual Studio 中为我的项目设置了一个 localdb,但是当我将它发布到我的 Azure Web 应用程序时,我得到
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 "
处理请求时发生未处理的异常.Win32Exception: 系统找不到指定的文件 TryGetConnection"
An unhandled exception occurred while processing the request. Win32Exception: The system canot find the file specified TryGetConnection"
我尝试添加一个DefaultConnection"连接字符串,其中数据库/服务器作为 Web 应用设置中的值,但没有做任何事情
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
推荐答案
Azure 不存在 LocalDb.LocalDb 是 SQL Server Express 的一项功能,在您部署应用服务网站的服务(机器)上没有该功能.
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.
当您转到 Azure 时,有很多选项可以替代 LocalDb.最简单(也是推荐的)是 使用Azure SQL 数据库,并在您发布网站时将您的连接字符串替换为指向该数据库的连接字符串.
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.
此处讨论了一些其他选项在 Azure 上使用 LocalDb MDF 文件一个>
Some other options are discussed here Using a LocalDb MDF file on Azure
这篇关于如何将本地数据库从 Visual Studio 连接到已发布的 Azure Web 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将本地数据库从 Visual Studio 连接到已发布的 Azure Web 应用程序?
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 输入按键事件处理程序 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
