SimpleMembership Problem and Solver

19Jun13

Hari ini lagi oprek fitur upgrade-an dari membership. Setelah dicoba, aku dapat beberapa exception ketika coba di unit testing.

Mungkin jika mengalami hal yang sama, siapa tau bisa bantu :

Exception :

Test method Scratch.Tests.SimpleMembership.SimpleMembershipTest.Init threw exception: System.Configuration.Provider.ProviderException: The Role Manager feature has not been enabled.

Solusi :

Set  enabled = true di role manager di web.config atau app.config

<roleManager enabled=”true” defaultProvider=”SimpleRoleProvider”>

<providers>

<clear/>

<add name=”SimpleRoleProvider” type=”WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData” connectionStringName=”LocalDatabase” />

</providers>

</roleManager>

Exception :

Could not load file or assembly ‘webmatrix.webdata’ for simplemembership unit testing

Solusi

Set copy local menjadi true di reference property untuk webmatrix.webdata dan webmatrix.data

SimpleMembership

Exception :

Test method Scratch.Tests.SimpleMembership.SimpleMembershipTest.Init threw exception:
System.Web.Security.MembershipCreateUserException: The Provider encountered an unknown error.

Solusi :

User-nya belum ada sehingga tidak bisa insert account.

jadi di buat seperti ini :

WebSecurity.CreateUserAndAccount(“Test”, “Password”,null, true);

bukan ini :

WebSecurity.CreateAccount(“Test”, “Password”,null, true);

Semoga membantu. 😀

Advertisements


No Responses Yet to “SimpleMembership Problem and Solver”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: