如何在生产机器上设置asp.net sql成员角色/成员资格提供程序?我正在尝试设置BlogEngine.NET,并且所有文档都说要使用Visual Studio中的ASP.NET网站管理工具,但这在生产机器上不可用.我是第一个在非开发盒上使用它的BlogEngine用户吗?
除了生产框之外,SQL服务器完全被阻止了,但我确实有SQL Management Studio.
编辑:我的意思是,你如何添加新用户/角色,而不是如何创建表.我已经运行了aspnet_regsql来创建模式.
EDIT2:MyWSAT不起作用,因为它也需要数据库中的初始用户.我需要一个应用程序,允许我在成员资格数据库中创建新用户而无需任何身份验证,只需一个连接字符串.
我通过在应用程序启动时设置默认超级用户来解决此问题.
将此添加到gobal.asax
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
// check that the minimal security settings are created
Security.SetupSecurity();
}
然后在安全类中:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; /// /// Creates minimum roles and user for application access. /// public class Security { // application roles public static string[] applicationRoles = { "Roles1", "Roles2", "Roles3", "Roles4", "Roles5" }; // super user private static string superUser = "super"; // default password, should be changed on first connection private static string superUserPassword = "default"; private Security() { // // TODO: Add constructor logic here // } /// /// Creates minimal membership environment. /// public static void SetupSecurity() { SetupRoles(); SetupSuperuser(); } /// /// Checks roles, creates missing. /// public static void SetupRoles() { // create roles for (int i = 0; i /// Checks if superuser account is created. /// Creates the account and assigns it to all roles. /// public static void SetupSuperuser() { // create super user MembershipUser user = Membership.GetUser(superUser); if (user == null) Membership.CreateUser(superUser, superUserPassword, "maintenance@acorel.com"); // assign superuser to roles for (int i = 0; i
拥有默认用户后,您可以使用AspNetWSAT或其他.