0

Describing this in detail is going to be tough but here goes:

Configuration


  • ASP.NET MVC 3.0 Website Project
  • Visual Studio 2010 SP1
  • Windows Azure Deployment including, Compute, Storage and SQL
  • SQL Azure has two sets of DB's; Development & Production

Problem


Using the ASP.NET Universal Providers I've setup a Development_ApplicationServices DB in my SQL Azure account. I've then gone in to the ASP.NET Configuration Website and created users for Development and assigned them to roles. As there are multiple developers working on this project this works well so we consistently have the same default accounts available to test role related use cases. Development has been running smoothly without any issues with the Providers.

I posted the Application to an Azure Compute Instance today for the 1st time and tried to login. Suddenly, the accounts we've been using, despite pointing at the same database are not working. If I register a new account it works fine while I'm in the Azure environment however, if I run in the development environment and then the account I created on the Azure instance using the default Register function of MVC in the Account Controller isn't accessible though I can see it in the DB if I query directly.

Question


  1. Does the Universal Provider embed something about the Site Context (for lack of a better term) into the hash for UserID or Password?
  2. Is there a best practice for the way I've configured by Dev/Prod environment, as it relates to SQL Azure and Membership Services, that I can use as reference?

Happy to answer questions to make this more clear but I'm pretty stumped at this point and don't know what would be relevant to include since this seems odd, to me at least.

Thanks in advance, K

Kefala
  • 100
  • 5
  • I your config file, do your providers have an applicationName? Is it the same in both prod and dev ApplicationServices tables? – danludwig Mar 19 '12 at 11:01

1 Answers1

0

I was also getting this exact same behavior. I posted a question on the official Azure forums ( http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/e8944c4d-5e22-4844-82fc-2e6863f0901a ) and was directed to the answer in another post here on stackoverflow I didn't find during my initial searching.

You'll find the answer here:

ASP.NET Membership - login works locally, fails on Azure

To summarize, the hashing type used on Azure is different from that which is now the default for .NET 4.0. You have to explicitely override the default machineKey element and the hashAlgorithmType attribute of the membership element in the Web.config to specify the hashing method to use.

It worked for me!

Community
  • 1
  • 1
bojingo
  • 572
  • 1
  • 6
  • 12