当前位置:  开发笔记 > 编程语言 > 正文

无法加载应用程序或执行命令'Microsoft.AspNet.Server.Kestrel'与1.0.0-rc1-update1

如何解决《无法加载应用程序或执行命令'Microsoft.AspNet.Server.Kestrel'与1.0.0-rc1-update1》经验,为你挑选了1个好方法。

我在天蓝网站上的kudo日志文件中读取以下错误:

Error: Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web.
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadFile(String assemblyPath)
   at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
   at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName)
   at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
   at Microsoft.Dnx.Host.DefaultLoadContext.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func`2 factory)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadAssemblyImpl(AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

我可以在本地运行我的网站:

C:\dev\ammo\ascend-ammo-wildlife>dnx web
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

project.json看起来像跟随并使用1.0.0-rc1-update1

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "artifacts",
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

有人可以指点我的方向来验证,以找出它失败的原因.



1> Poul K. Søre..:

将文件从我的项目逐个复制到一个正在运行的空项目我能够找出问题所在.

项目中存在global.json是个问题.

还应该注意到我的项目结构对于前端项目看起来像这样:

/
/wwwroot/
/src/ //Typescript files compiles into wwwroot
/typings/ //tsd typings
/global.json //This was the one that caused the issue, after deleting everything worked
/tsd.json
/tsconfig.json
/startup.cs
/project.json
/package.json
/gruntfile.js
/bower.json
/project.xproj
/project.sln

普通vs项目通常具有global.json文件所在的父解决方案文件夹

推荐阅读
Life一切安好
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有