I want to deploy my ASP.NET application to MS Azure (and SQL Azure). The application is using code-first.
After publishing my application and calling the corresponding URL I receive an error message saying:
Login failed for user ‘myUserName’. This session has been assigned a tracing
ID of ‘8beaff1c-629f-45b3-991b-228425bc30a4’.Provide this tracing ID
to customer support when you need assistance.
I’m pretty sure this is due to connection strings in my config files.
Here is the relevant extract from my web.config:
<connectionStrings>
<add name="dbContext"
connectionString="server(local)\SQLEXPRESS;database=myDB;integrated security=true;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
And here is the corresponding web.release.config:
<connectionStrings>
<add name="ApplicationServices" connectionString="Server=tcp:xt1rnwvt89.database.windows.net;Database=myDB;User ID=myUserName@xt1rnwvt89;Password=myPassword;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="dbContext" connectionString="Server=tcp:xt1rnwvt89.database.windows.net,1433;Database=myDB;User ID=myUserName@xt1rnwvt89;Password=myPassword;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
I’m not sure if I need both the ApplicationServices and dbContext settings…?
Of course the credentials given above are anonymized. But the real credentials should be correct, because I can successfully connect to my Azure database with SQL Server Management Studio (SSMS).
I already checked several documentations and tutorials like https://www.windowsazure.com/en-us/develop/net/tutorials/web-app-with-sql-azure/, but I couldn’t find a solution yet. Everything seems to be ok.
Does anybody have an idea?
This is the connectionstring I use:
Also make you sure set the correct firewall settings:
If you want to make sure you use the correct connection you can ask the correct one from the management portal. Just click your databasename on the left and then you can see the connection string on the right panel.
Edit
Also when using Code First make sure the database doesn’t already exist because the database drop won’t work.