Azure 上的新 Serenity 部署失败,对象名称无效 'Languages'

New Serenity deployment failing on Azure with Invalid object name 'Languages'

使用 Serenity 框架 v 5.0.24。 我有一个带有一些小演示的新解决方案,所有这些都在本地运行,但是当我尝试将它部署到 Azure 资源时,它似乎甚至无法创建数据库,但我不明白为什么。 'Languages' 是初始迁移单元中的第二件事,所以我假设它是。 我之前在以前的版本上部署过几十个 Serenity 应用程序,所以我不是新手。 这是原始异常输出:

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Languages'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at Serenity.Data.SqlHelper.ExecuteReader(IDbConnection connection, String commandText, IDictionary`2 param, ILogger logger)
   at Serenity.Data.SqlHelper.ExecuteReader(IDbConnection connection, SqlQuery query, ILogger logger)
   at Serenity.Data.EntitySqlHelper.ForEach(SqlQuery query, IDbConnection connection, Action callBack)
   at Serenity.Web.RowLookupScript`1.GetItems()
   at Serenity.Web.LookupScript.GetScript()
   at Serenity.Web.DynamicScriptManager.<>c__DisplayClass16_0.<EnsureScriptContent>g__factory|0()
   at Serenity.TwoLevelCacheExtensions.GetInternal[TItem](ITwoLevelCache cache, String cacheKey, TimeSpan localExpiration, TimeSpan remoteExpiration, String groupKey, Func`1 loader, Boolean localOnly)
   at Serenity.TwoLevelCacheExtensions.GetLocalStoreOnly[TItem](ITwoLevelCache cache, String cacheKey, TimeSpan localExpiration, String groupKey, Func`1 loader)
   at Serenity.Web.DynamicScriptManager.<>c__DisplayClass16_0.<EnsureScriptContent>g__getOrCreate|1()
   at Serenity.Web.DynamicScriptManager.EnsureScriptContent(String name, IDynamicScript script)
   at Serenity.Web.DynamicScriptManager.GetScriptText(String name)
   at AspNetCore.Views_Shared__LayoutHead.ExecuteAsync() in C:\Projects\research\distanceSignOff\distanceSignOff.Web\Views\Shared\_LayoutHead.cshtml:line 21
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.RenderPartialViewAsync(TextWriter writer, Object model, IView view)
   at Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
   at AspNetCore.Views_Shared__LayoutNoNavigation.<ExecuteAsync>b__9_0() in C:\Projects\research\distanceSignOff\distanceSignOff.Web\Views\Shared\_LayoutNoNavigation.cshtml:line 7
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
   at AspNetCore.Views_Shared__LayoutNoNavigation.ExecuteAsync() in C:\Projects\research\distanceSignOff\distanceSignOff.Web\Views\Shared\_LayoutNoNavigation.cshtml:line 5
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at StackExchange.Exceptional.ExceptionalMiddleware.Invoke(HttpContext context)
   at StackExchange.Exceptional.ExceptionalMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
ClientConnectionId:f3bf9b09-8ec0-45dd-b2e3-28445db434a9
Error Number:208,State:1,Class:16
ClientConnectionId before routing:6066e64d-1796-4b10-bf92-233e7990242a
Routing Destination:aed1b953e0aa.tr14046.eastus1-a.worker.database.windows.net,11009

为了别人的利益,我发现了自己的问题。 我忽略了在第 203 行附近删除 DataMigrations.cs 中的迁移安全检查,这部分阻止你随意编写新数据库。 我记得(也许)在过去,应用程序会警告您已跳过迁移,而不仅仅是在未找到第一个 SQL 对象时拉出异常。 很容易搞定,但我觉得有点傻!