我正在尝试使用 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/