asp.net - "The connection string specifies a local Sql Server Express instance",但事实并非如此

标签 asp.net sql-server deployment

我正在尝试使用 ApplicationServices 成员数据库的 SQL Server 实例将 ASP.NET 应用程序部署到服务器。

问题是,我收到一条错误消息

The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory

当我最初尝试使用应用程序部署 aspnetdb.mdf 本身时,出现此错误。

当我放弃该计划并决定进行 web.config 转换时,我收到了此错误,以便在调试中使用 Express 数据库,但在发布时连接字符串将转到 SQL Server。

当我出于好奇决定从代码中删除对 Express 数据库的所有引用时,我再次遇到此错误,因此不可能有任何东西会查找 Express 数据库。运气不好。

有人对此有什么想法吗?我每次都在 IIS 中删除并重新安装该网站,注意到没有部署 App_Data,并且 web.config 中没有提及 .mdf 文件 - 无济于事。它仍然认为有一个连接字符串告诉它寻找 SQL Server Express 数据库:/

编辑:这是我正在使用的连接字符串。我认为相当标准,但我总是可能是错的。

Data source=HERP;Initial Catalog=DERP;Integrated Security=True

最佳答案

该错误是否引用 machine.config 中的默认连接字符串?文件(LocalSqlServer 之一)?考虑到default membership provider uses this connection string,这种情况可能会发生。 :

The following default membership element is configured in the Machine.config file [...]:

<membership>
<providers>
<add name="AspNetSqlMembershipProvider" [...]
connectionStringName="LocalSqlServer" [...]

关于asp.net - "The connection string specifies a local Sql Server Express instance",但事实并非如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8596953/

相关文章:

deployment - 在本地主机 [域 1] 上发布到 GlassFish 4 时遇到了 ....,无法部署 abconlinetest

google-app-engine - 当我通过 GoogleAppEngineLauncher 部署代码时,它会上传所有文件吗?

java - Eclipse 无法正确复制上下文

SQL Server 查询以更新具有相同名称的多行

c# - 如何使用 JavaScriptSerializer 解析带有数字键的 JSON 对象

c# - 哪个更好,什么时候: using statement or calling Dispose() on an IDisposable in C#?

C# JSON 解析问题

sql-server - 禁用 SA,创建新登录,将数据库角色成员更改为数据库所有者

mysql - 数据库设计 - 此约定的名称?

c# - 在网站应用程序上显示错误/警告消息的最佳方式是什么?