嗯......我真的无法理解这个。
在 web.config 我有:
<connectionStrings>
<clear /> <!--- need this to prevent using LocalSqlServer from machine.config or somewhere becouse it is not present when when publish to hosting -->
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Goaly-20120615111028;Integrated Security=SSPI" />
</connectionStrings>
和
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<!-- I think this line is telling asp.net that I want the membership working agains defaultconnection, and not LocalSqlServer connection????? -->
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
但后来它抱怨:
The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
当我在设置选项卡中使用来自 VS2012 RC 的发布时,我得到一个 ModelContext 和一个 DefaultConnection,那么这应该如何工作?
我想要的只是在与模型上下文创建的表相同的数据库中获取成员表。
这应该是如此oob,但我一定是在某种程度上过于复杂了。
谢谢你的帮助。
问候
拉尔西