Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...