首页新闻找找看学习计划

本地测试没问题,为啥传到服务器发生错误找不到包 'Microsoft.NETCore.App'

0
悬赏园豆:50 [已解决问题] 解决于 2019-05-14 14:56
21:44:51 [Error] Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware 
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.NETCore.App'
   at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List`1 assemblies)
   at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
   at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.<GetReferencePaths>b__8_0(CompilationLibrary library)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable`1 parts, MetadataReferenceFeature feature)
   at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences()
   at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
   at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences()
   at Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References()
   at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectEngine.ProcessCore(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.Process(RazorProjectItem projectItem)
   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.LocatePageFromPath(String executingFilePath, String pagePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.GetView(String executingFilePath, String viewPath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.GetView(String executingFilePath, String viewPath, 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 StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 94
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Silver.Core.Http.InstallUrlMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in D:\Users\Silver\Documents\Visual Studio 2017\Projects\Silver.NiaoNiao.MiniProgram\Silver.Core\Http\InstallUrlMiddleware.cs:line 45
   at Silver.Core.Http.KeepAliveMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in D:\Users\Silver\Documents\Visual Studio 2017\Projects\Silver.NiaoNiao.MiniProgram\Silver.Core\Http\KeepAliveMiddleware.cs:line 34
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
21:44:51 [Error] Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware 
An exception was thrown attempting to execute the error handler.
System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.NETCore.App'
   at Silver.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.<>c.<UseSilverExceptionHandler>b__6_1(HttpContext context) in D:\Users\Silver\Documents\Visual Studio 2017\Projects\Silver.NiaoNiao.MiniProgram\Silver.Web.Framework\Infrastructure\Extensions\ApplicationBuilderExtensions.cs:line 165
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
21:44:51 [Error] Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware 
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.NETCore.App'
   at Silver.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.<>c.<UseSilverExceptionHandler>b__6_1(HttpContext context) in D:\Users\Silver\Documents\Visual Studio 2017\Projects\Silver.NiaoNiao.MiniProgram\Silver.Web.Framework\Infrastructure\Extensions\ApplicationBuilderExtensions.cs:line 165
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)

服务器重新安装了.net core也不行

请问有啥解决办法吗?

远扬的主页 远扬 | 初学一级 | 园豆:86
提问于:2019-05-13 21:50
< >
分享
最佳答案
0

dotnet --info 命令看一下服务器与本机的 .net core runtim 版本是否一致

收获园豆:50
dudu | 高人七级 |园豆:40812 | 2019-05-13 22:11

版本没问题,我是在访问插件路径时候发生的错误,程序本身访问并未发生错误

使用的nopcommerce的插件方案

远扬 | 园豆:86 (初学一级) | 2019-05-14 10:53

@dudu: 谢谢~

远扬 | 园豆:86 (初学一级) | 2019-05-14 14:56
其他回答(2)
0

对比下dotnet --list-runtimes的在本机和服务器的差异。

blackheart | 园豆:1908 (小虾三级) | 2019-05-14 12:02
0

记录下,其中一个解决方案是:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>

MvcRazorExcludeRefAssembliesFromPublish

alby | 园豆:321 (菜鸟二级) | 2019-05-14 19:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册