私の問題はSO のこの問題と非常に似ていますが、完全ではありません。
Azure データベースにローカルで接続すると、完全に動作します。しかし、Azure にデプロイすると、データベースに接続できないようです。最初に Entity Framework 5 コードを使用しており、EF 5 参照で copy local:true も設定しています。
これらは私の接続文字列です:
<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"/>
追加した
<customErrors mode="Off"/>
私のweb.configファイルで、スタックトレースを確認できるようにしました。これらは私が得た例外です:
[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.
スタックトレースを読むと、メンバーシップデータベースを初期化できないことが問題であることは確かです。これは Azure デプロイの問題である必要がありますが、私はそれを理解できないようです..
編集:
API データベースは現在機能していますが、メンバーシップで同じエラーが発生します。Web サイトを共有ではなく予約するようにスケーリングしました。それが何らかの影響を与える可能性があるかどうかはわかりません。
修繕:
うーん、これは奇妙なことです.. 突然、Web サイトが両方のデータベースに接続されました。サーバーを共有から予約済みに変更する以外は何もしませんでした..