3

My problem is very similiar with this problem on SO, but not quite.

When i connect to my azure database locally, it runs perfectly. But when i deploy to Azure, it seems it cannot connect to the database. I'm using Entity Framework 5 code first, and i have also set copy local:true on the EF 5 reference.

These are my connection strings:

    <add name="api" connectionString="
    Server=tcp:[hidden].database.windows.net,1433;Database=API;
    User ID=[hidden]@[hidden];
    Password=[hidden];Trusted_Connection=False;
    Encrypt=True;Connection Timeout=30;
    PersistSecurityInfo=True;" providerName="System.Data.SqlClient" />

    <add name="Membership" connectionString="
    Server=tcp:[hidden].database.windows.net,1433;
    Database=Membership;User ID=[hidden]@[hidden];
    Password=[hidden];Trusted_Connection=False;
    Encrypt=True;Connection Timeout=30;
    PersistSecurityInfo=True;" providerName="System.Data.SqlClient"/>

I added

    <customErrors mode="Off"/> 

in my web.config file so i could see the stacktrace, and these are the exceptions i got:

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
[ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string.

When reading the stacktrace, it is certain that the problem is that i can't initialize the membership database. This have to be a Azure deploy issue, but i can't seem to figure it out..

EDIT:

The API-database is now working, but the membership gives the same error. I scaled the web site to be reserved instead of shared. Don't know if that could have any impact.

FIXED:

Well this is just strange.. Suddenly the web site has connection with both databases. Didn't do anything other changing the server from Shared to Reserved..

2
  • Am assuming you've set the SQL Azure firewall to allow Windows Azure Services? Commented Mar 7, 2013 at 15:21
  • Yes i have set it to allow Windows Azure Services :) Commented Mar 7, 2013 at 15:31

2 Answers 2

3

Check the IP rules made on Windows Azure portal and make sure your current IP address is within the range you allowed to access the database running on Windows Azure

Sign up to request clarification or add additional context in comments.

1 Comment

I did. And to test, i even added ip address from range 0.0.0.0-255.255.255.255. Still didn't work :(
0

Make sure that your IP address is in the list of allowed IP addresses for the database.

1 Comment

Referring to the above comment :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.