c# - 在 Azure 应用服务中使用 LocalDB

标签 c# asp.net azure active-directory

我在 Web 配置中有以下连接字符串,并且在 Visual Studio 中工作正常。

<connectionStrings>
   <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-MyPortal-20170627104450.mdf;Initial Catalog=aspnet-MyPortal-20170627104450;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>

我尝试使用 Azure 应用服务和 Azure AD 将 ASP.NET MVC 应用程序移植到 Azure。我更改了 AttachDbFilename 属性,如下所示

AttachDbFilename=\App_Data\aspnet-MyPortal-20170620051631.mdf

我收到以下错误:

Invalid value for key 'attachdbfilename'.
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.ArgumentException: Invalid value for key 'attachdbfilename'.
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.

App Data 文件夹包含 mdf 文件。如何在 Web 配置的连接字符串中引用它?

是否有 Azure Web 应用程序通过 Azure AD 进行身份验证的示例程序?

最佳答案

简而言之,您无法在 Azure 应用服务中使用 LocalDB。

还有另一个答案 - How to connect a localdb from Visual Studio to the published Azure web app?

关于c# - 在 Azure 应用服务中使用 LocalDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44841031/

相关文章:

c# - ASP .NET RowUpdating GridView 问题

azure - Windows Azure 服务器上安装了哪个版本的 .net?

c# - 如何检查控件是否为按钮?

c# - MongoDB 中的正则表达式 + 选项(C# 驱动程序)

c# - 在 C# 中使用列表

c# - .net开发代码结构-Controllers, Services, Repositories & Contexts

javascript - 使用 javascript 更改动态创建的 ASP.NET 图像控件

azure - 尝试通过服务管理 API 在 Azure 中创建虚拟机部署

azure - HTTP 响应是 404 而不是 401 与authorization.json 我错过了什么吗?

c# - 递归调用返回一个列表,返回类型导致我出现问题