Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET TableStorageProvider for Azure tables not persisting users?
    primarykey
    data
    text
    <p>I have a windows azure Webrole application using Silverlight on top of WCF+ASP.NET. I found this useful ASP.NET provider for Azure tables in the <a href="http://code.msdn.microsoft.com/windowsazuresamples" rel="nofollow noreferrer">Azure samples</a> and implemented it. I authenticate my users with the WCF service <code>System.Web.ApplicationServices.AuthenticationService</code>. </p> <p>It works great: I create my users with a very simple ASP.NET form, then I go to my Silverlight app and authenticate successfully, but when I shutdown the Azure development storage environment and restart it, I can't log in again, even if the user is still in the Membership table. I debugged the logging process and found that when the provider executes the query to the table, it throw an exception in this method:</p> <pre><code>private MembershipRow GetUserFromTable(DataServiceContext svc, string username) { SecUtility.CheckParameter(ref username, true, true, true, Constants.MaxTableUsernameLength, "username"); DataServiceQuery&lt;MembershipRow&gt; queryObj = svc.CreateQuery&lt;MembershipRow&gt;(_tableName); var query = (from user in queryObj where user.PartitionKey == SecUtility.CombineToKey(_applicationName, username) &amp;&amp; user.ProfileIsCreatedByProfileProvider == false select user).AsTableServiceQuery(); IEnumerable&lt;MembershipRow&gt; allUsers = query.Execute(); if (allUsers == null) { return null; } IEnumerator&lt;MembershipRow&gt; e = allUsers.GetEnumerator(); if (e == null) { return null; } // e.Reset() throws a not implemented exception // according to the spec, the enumerator is at the beginning of the collections after a call to GetEnumerator() if (!e.MoveNext()) { return null; } MembershipRow ret = e.Current; if (e.MoveNext()) { throw new ProviderException("Duplicate elements for primary keys application and user name."); } return ret; } </code></pre> <p>the <code>queryObj</code> variable contains the user entry when I check during execution, but <code>query</code> looks like it contains an exception in one of its member. Finally, the execution fails when making the <code>e.moveNext()</code>.</p> <p>If I just delete all the Membership tables and blobs and recreate a user, it works just normally.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload