SqlProfileProvider
我试图让 SqlProfileProvider 使用我自己的数据库,我已经使用 aspnet_regsql 设置了数据库,然后使用以下 web.config,但应用程序不断创建 aspnetdb 并且从不填充我的数据库中的任何表。
<connectionStrings>
<add name="Database"
connectionString="Server=MYSERVER;Integrated Security=True;Initial Catalog=MYDB"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<profile defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="Database"
applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false" />
I am trying to get SqlProfileProvider working with my own db, I have set up the db using aspnet_regsql and then the following web.config, yet the application keeps creating an aspnetdb and never populates any of the tables in my db.
<connectionStrings>
<add name="Database"
connectionString="Server=MYSERVER;Integrated Security=True;Initial Catalog=MYDB"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<profile defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="Database"
applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在
标记后立即添加
标记。我似乎记得几年前也遇到过类似的问题,这是由我的 web.config 从其他地方继承连接字符串引起的。http://msdn.microsoft.com/en-us/library/ayb15wz8.aspx
编辑:
实际上,您还应该向您的会员提供商添加
标记。常见问题:添加提供程序时不要忘记
Try adding a
<clear />
tag immediately after the<connectionStrings>
tag. I seem to remember having a similar problem years ago that was caused by my web.config inheriting a connection string from somewhere else.http://msdn.microsoft.com/en-us/library/ayb15wz8.aspx
EDIT:
Actually, you should also add the
<clear />
tag to your membership providers as well.Common Gotcha: Don't forget to
<clear/>
when adding providers