- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经在服务器上部署了我的 ASP.NET MVC 5 应用程序,但它在使用 localdb 的每个页面上都崩溃了。
但是我复制了 .mdf
文件所在的 App_Data
文件夹。我什至在机器上安装了 SQL Server 2012 Express。
然而每次我都遇到同样的错误。
Le fichier spécifié est introuvable
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.ComponentModel.Win32Exception: Le fichier spécifié est introuvable
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.
Stack Trace:
[Win32Exception (0x80004005): Le fichier spécifié est introuvable]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352431
抱歉,尽管我将用户界面设置为美国英语,但它的一部分是法语。
web.config
文件如下所示:
<connectionStrings>
<add name="ConnectionString"
connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=C:\inetpub\wwwroot\MygLogWeb\App_Data\Database.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
之前是这样的:
<add name="ConnectionString"
connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
最佳答案
那是因为 LocalDb 不适用于生产用途。
参见文章:Creating an Entity Framework Data Model for an ASP.NET MVC Application
具体来说,文章中的这段文字:“通常 SQL Server Express 不用于生产 Web 应用程序。特别不建议将 LocalDB 用于 Web 应用程序的生产使用,因为它不是为与 IIS 一起工作而设计的。”
因此,更改您的 connectionString 值以使用真正的 sql server 数据库,您应该可以开始了!
关于c# - 部署 ASP.NET MVC + LocalDB 应用程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20476608/
我在集成测试环境中使用 LocalDb - 在测试运行之前和之后实例化和处理我的实例。 但是,当我在我的实例中创建一个数据库时,它仍然会将我的表和数据刷新到磁盘。是否可以在“内存中”模式下运行 Loc
我使用的是 SQL Server 2014 Express 和 LocalDB 选项,并且 Visual Studio 2013 中的 SQL Server 对象资源管理器 Pane 中有以下内容..
重现步骤。 列出现有实例: > sqllocaldb info v11.0 停止指定名称的实例: > sqllocaldb stop "v11.0" Stop of LocalDB instance
我无法在开发人员机器上添加数据库。 我正在运行 win 10,visual studio 2015。 我重新安装了 SQL Server 2016 两次,上次禁用了防火墙,最后都给了绿色标记。 虽然我
我将VS2012和SSME 2012与localdb一起安装,发现有两台服务器可以连接到:(localDB)\v11.0和(localDB)\Projects。 我必须使用它们中的哪一个来执行,它们分
我们的应用程序使用 SQL Server LocalDb 2014 作为数据库引擎。我们使用的连接字符串是 "Data Source=(localdb)\MSSQLLOCALDB;Initial Ca
我刚刚完成了 VS2015 的全新安装 更新 2 在一个新工作站上,并开始运行一些使用 SQL LocalDb 的集成测试。他们失败了以下 SqlException : Additional info
当我尝试从 C# 访问数据库时,出现此异常。 我的连接字符串是 Data Source=(localdb)\v11.0;integrated security=true;User Instance =
我使用 SqlLocalDb.msi 包安装了 LocalDb,并且可以使用服务器名称 (LocalDb)\v11.0 使用 SSMS 连接到它。到目前为止,一切都很好。问题是,当我尝试通过 .NET
我正在尝试在本地复制生产环境,而生产数据库使用链接服务器。我已经能够创建 localdb 的多个实例;是否可以在 localdb 实例之间创建链接服务器?如果没有,我还有哪些其他选项可用(理想情况下不
我首先使用实体框架 6 代码。 目前我有一个用于生产的数据库。我想为测试添加一个不同的数据库。我怎么做? 我的测试项目中是否需要另一个连接字符串? 这两个连接字符串应该有什么区别? 我尝试复制连接
我以前从未在应用程序中使用过 LocalDB。我有两个问题: 1) LocalDB 仅用于测试还是有时会在实际环境中推出?2) 我注意到连接字符串因 PC 而异。例如,请查看下面适用于我的台式电脑(使
我正在尝试运行一个 IIS 托管的应用程序(以电影数据库的形式)来自学如何设计一个 3 层架构程序:MVC 应用程序、WCF 服务、SQL Server 数据库。因为我没有完整的 SQL Server
我正在尝试在 Ubuntu 17.04 上启动 .Net Core 2.0 应用程序。我之前在 Windows 10 上开发过它并且运行良好。问题是,当我运行 dotnet ef database u
我正在尝试为我的 ASP.NET Web API 项目编写单元/集成测试,并努力单独运行每个测试。请允许我解释一下。 我有一个配置了部署设置的 *.testsettings 文件。在每次测试运行之前,
我正在尝试为我的 Windows 窗体应用程序创建备份和恢复功能。 因此,我尝试进行数据库恢复。我的代码是这样的: string cbdfilename = "c:\\Users\\Public\\P
如何删除已删除其文件的 SQL LocalDB 数据库? 删除数据库会产生以下消息: Unable to open the physical file "C:\Users\Public\Documen
我有以下 F# 脚本。我从正在运行的 Asp.net Mvc 项目复制了连接字符串。但是,它出现以下错误。连接字符串应该正确,因为 Asp.Net Mvc 项目工作正常。或者 F# 类型提供程序不接受
我使用本地开发的网站收集了一堆数据。现在我需要分析数据,但我似乎无法找到我的网站使用的 LocalDB 数据库的 .mdf 文件。 查看数据连接,显示myusername\localdb#abunch
我有一个像这样的 VS 2012 解决方案设置: 英孚模型项目 EF模型测试项目 ASP.NET MVC 4 应用程序 WCF数据服务项目 在开发过程中,我想使用 LocalDB 作为 EF 的后备数
我是一名优秀的程序员,十分优秀!