只要您在新的开发环境中拥有 Framework 2.0 或更高版本并且可以访问包含该模式的数据库,它就是“可移植的”。
aspnet_regsql.exe 应用程序仅用于生成 db 架构。当指定您的提供者时,真正的交易发生在 web.config 中。
只要您在连接字符串或包含成员资格提供程序架构的数据库中有 .mdf 文件引用,一切都应该正常工作。
连接字符串:
<connectionStrings>
<add name="LocalSQL" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=YourCatalog;Persist Security Info=True;User=sa;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>
会员提供者:
<membership defaultProvider="DefaultProvider" userIsOnlineTimeWindow="30">
<providers>
<clear/>
<add name="DefaultProvider" connectionStringName="LocalSQL" applicationName="DefaultApp" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</membership>