Azure + Silverlight 4 + RIA Services + MVC2 (Part 3)
by Peter Daukintis
Next up is getting the authentication service to use azure table storage.
To do this you need to get the additional azure code samples from here http://code.msdn.microsoft.com/windowsazuresamples and include the asp providers project into the solution (this will need to be up converted as the project is for vs2008). Then include a reference to this in the host website project.
For my scenario, where I am not running my app as a cloud service, I need to add settings to my web.config file to provide settings for the various providers. It was quite challenging to work out what exactly was required here but I got things working with the following in my web.config:
<membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow = "20"> <providers> <clear/> <add name="TableStorageMembershipProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageMembershipProvider" description="Membership provider using table storage" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="true" passwordFormat="Clear" applicationName="YourAppName" accountName="youracctname" sharedKey="xxxxxx" allowInsecureRemoteEndpoints="true" tableServiceBaseUri="http://youracctname.table.core.windows.net/" /> </providers> </membership> <roleManager enabled="true" defaultProvider="TableStorageRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration = "true" cookieProtection="All" > <providers> <clear/> <add name="TableStorageRoleProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageRoleProvider" description="Role provider using table storage" allowInsecureRemoteEndpoints="true" applicationName="YourAppName" accountName="youracctname" sharedKey="xxxxxx" tableServiceBaseUri="http://youracctname.table.core.windows.net/" /> </providers> </roleManager> <sessionState mode="Custom" customProvider="TableStorageSessionStateProvider"> <providers> <clear /> <add name="TableStorageSessionStateProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider" allowInsecureRemoteEndpoints="true" applicationName="YourAppName" accountName="youracctname" sharedKey="xxxxxx" tableServiceBaseUri="http://youracctname.table.core.windows.net/" blobServiceBaseUri="http://youracctname.blob.core.windows.net/" /> </providers> </sessionState>
I struggled a bit to get this to work but changing the passwordFormat to Clear made everything work so I have assumed that there’s a bug with the Hashed passwords currently.
By the way, I used this tool http://azurestorageexplorer.codeplex.com/ with great success for confirming whether data was being written/read correctly and whether the tables were being created successfully.
Comments