asp.net Membership.CreateUser()没有创建用户

时间:2016-01-04 22:51:20

标签: c# asp.net asp.net-mvc

我的数据库已经在我的数据库中为aspnet_Membership,aspnet_Users for Membership和I AspNetUsers创建,因为我以前使用过不同的方式。无论如何,我的连接对我的数据库很好,因为它将用户插入AspNetUsers但我想使用Membership,所以当我调用Membership.CreateUser()时,它不会插入我的表aspnet_Membership。

有什么想法吗?

的Web.config

#!/system/bin/sh                                                                               

# battery threshold before boot-up (in percent)                                                
bthresh=10

# time to sleep between checks (in seconds)                                                    
sleeptime=600

# file that contains current battery level as integer between 0 and 100                        
cfi=/sys/class/power_supply/battery/capacity
# file that contains 1 if we're plugged in to AC, 0 if not                                     
acfi=/sys/class/power_supply/battery/subsystem/ac/online

# if either file doesn't exist, just do normal sleep+boot                                      
[ ! -f $cfi ] && sleep $sleeptime && /system/bin/reboot
[ ! -f $acfi ] && sleep $sleeptime && /system/bin/reboot

# populate capacity and AC variables                                                           
c=`cat $cfi`
ac=`cat $acfi`

# stop loop if we're not plugged into AC                                                       
until [ "$ac" -eq 0 ]
do
    # if capacity above threshold, boot up                                                     
    if [ "$c" -gt "$bthresh" ]; then
    /system/bin/reboot
    fi

    # wait some time before next check                                                         
    sleep $sleeptime

    # update capacity and AC variables                                                         
    c=`cat $cfi`
    ac=`cat $acfi`
done

Register.aspx.cs

    <connectionStrings>
        <add name="DefaultConnection" 
          connectionString="Data Source=LAPTOP\SQLExpress; Initial Catalog=Application; Integrated Security=True;"
          providerName="System.Data.SqlClient" />
    </connectionStrings>
    <membership defaultProvider="MembershipProvider" userIsOnlineTimeWindow="10">
      <providers>
        <add name="MembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionString="Data Source=LAPTOP\SQLExpress; Initial Catalog=Application; Integrated Security=True;" connectionStringName="DefaultConnection" applicationName="Application"/>
      </providers>
    </membership>

1 个答案:

答案 0 :(得分:1)

检查createStatus枚举的值,了解无法创建用户的原因。您还可以使用Website Administration Tool手动创建用户,看看是否收到了更多信息性错误消息。