> .Net4.0
> MVC 2
> NHibernate
> NUnit
> MVC 2
> NHibernate
> NUnit
我正在尝试测试用户创建.根据我的测试,我打电话给以下人员:
@H_404_7@MembershipCreateStatus status; // _session is my current NHibernate session. var mmp = new MyMembershipProvider(_session); mmp.CreateUser(username,password,"something@example.com","",true,Guid.NewGuid(),out status);在CreateUser方法中,它得到了这么远:
@H_404_7@var user = new MembershipUser(Name,username,providerUserKey,email,passwordQuestion,passwordAnswer,isApproved,false,DateTime.Now,DateTime.Now);…在抛出此异常之前:
@H_404_7@The membership provider name specified is invalid. Parameter name: providerName我将我的名字设置为MyMembershipProvider,在Web.config中我有这个:
@H_404_7@<add name="OnyxMembershipProvider" type="System.Web.Security.sqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minrequiredPasswordLength="6" minrequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />还有,我的连接字符串:
@H_404_7@<add name="ApplicationServices" connectionString="data source=.\sqlEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.sqlClient" />现在,我猜测问题是我的测试是创建一个sqlite数据库,而web.Config正试图命中我的sqlServer数据库,但我不知道如何继续.