我的.NET Core 2.1 Web应用程序无法在Azure App Service上启动。在本地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.App 2.1.5(最新)。运行dotnet --list-sdks
返回2.1.403
我想念什么?
P.S。虽然找不到解决方案,但我从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)