如何将localdb从Visual Studio连接到已发布的Azure Web应用程序? [英] How to connect a localdb from Visual Studio to the published Azure web app?

查看:143
本文介绍了如何将localdb从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 App设置中的值,但这没有任何作用

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的功能,在部署App Service网站的服务(计算机)上没有此功能.

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

这篇关于如何将localdb从Visual Studio连接到已发布的Azure Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆