Приложение .NET Core 2.1 не работает в Azure, но работает в других местах - PullRequest
0 голосов
/ 20 ноября 2018

Мое веб-приложение .NET Core 2.1 не запускается в службе приложений Azure.Он отлично работает в IIS Express локально или на Raspberry Pi.

Ошибки return type must be 'Task' to match overridden member и Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found - я их раньше не видел.Похоже, какое-то несоответствие версий, но после проверки все кажется законным и, как я уже сказал, работает нормально при развертывании в Linux / RaspberryPi.Views_Home_Landing относится к моему действию по умолчанию на контроллере.

Я пытался развернуть автономный и зависящий от фреймворка, но ошибка всегда одна и та же.

Запуск dotnet --list-runtimes возвращает Microsoft.NETCore.App 2.1.5 и Microsoft.AspNetCoreПриложение 2.1.5 (последняя версия).Запуск dotnet --list-sdks возвращает 2.1.403

Что мне не хватает?

PS Хотя я не нашел решения, я удалил приложение из Azure и развернул его как новое приложение, и оновсе работало нормально.

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
  An unhandled exception has occurred while executing the request.
Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:
mkitun4v.pui(70,67): error CS0508: 'Views_Home_Landing.ExecuteAsync()': return type must be 'Task' to match overridden member 'RazorPageBase.ExecuteAsync()'
mkitun4v.pui(70,67): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(75,13): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(75,37): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(187,43): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(332,19): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(335,23): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(343,13): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(343,45): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(362,13): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
mkitun4v.pui(362,38): error CS7069: Reference to type 'Task' claims it is defined in 'System.Runtime', but it could not be found
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(RazorCodeDocument codeDocument, String generatedCode)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.OnCacheMiss(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
...