“The connection string specifies a local Sql Serve

2019-06-17 06:09发布

I'm trying to deploy an asp.net application to a server using a SQL Server instance for the ApplicationServices membership database.

The problem is, I'm getting an error that says

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

I got this error when I initially tried to deploy the aspnetdb.mdf itself with the application.

I got this error when I then scrapped that plan and decided to do a web.config transform so that in Debug I use the Express database, but on Release the connection string goes to SQL Server.

I got this error again when I decided out of curiosity to remove all references to the express database from the code, so there could be no possible way anything would be looking for the Express database. No luck.

Does anyone have any ideas about this? I have deleted and re-installed the web site in IIS each time, noting that there is no App_Data being deployed and no mention of the .mdf file in web.config - to no avail. It still thinks there's a connection string telling it to look for a SQL Server Express database :/

Edit: Here's the connection string I'm using. Pretty standard, I think, but I could always be wrong.

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

2条回答
Ridiculous、
2楼-- · 2019-06-17 06:38

Do not forget to clear the connectionStrings first:

<connectionStrings>
   <clear />
   <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/> 
</connectionStrings>
查看更多
仙女界的扛把子
3楼-- · 2019-06-17 06:50

Could the error refer to the default connection string from the machine.config file (the LocalSqlServer one)? This could be happening, considering that the 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" [...]

查看更多
登录 后发表回答