我在發佈到Azure服務器後嘗試重置密碼時收到此錯誤。但是,它適用於本地主機和所有其它功能像註冊,ConfirmEmail和登錄現場工作..等 錯誤:ResetPassword上的Asp.Net Identity 2.0無法連接到SQL Server數據庫。Azure web應用程序上的錯誤
Unable to connect to SQL Server database. Method Message:, LogException: System.Web.HttpException: Unable to connect to SQL Server database. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
在蔚藍我的連接字符串的樣子:
Server=tcp:server.database.windows.net,1433;Database=MyDb;User ID=username;Password=password;Trusted_Connection=False;Encrypt=True
與選項Custom
我不能在我身邊重現這個問題,'ChangePassword'功能在我的web應用程序中可以在本地和Azure上運行。你可以嘗試[遠程調試](https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-dotnet-troubleshoot-visual-studio#remotedebug)你的網絡應用程序來檢查控制器動作''ChangePassword(ChangePasswordViewModel模型)''中'dbcontext'的連接。此外,如果可能的話,你可以分享你的項目,然後我可以測試你的代碼來找到問題。 –
驗證您的Azure *服務器名稱*和*防火牆規則* – Jayendran