运行Asp.net 5 vNext项目(MVC6)在Windows Server 2012 R2上发布版本

时间:2016-01-11 22:38:53

标签: c# asp.net iis asp.net-core-mvc asp.net-core

我根据互联网上的一些资源配置了一切,但我不知道我想念的是什么..

当我尝试手动启动它时(在我的本地计算机上运行!)我在服务器上得到以下结果:

PS C:\Users\Administrator> cd C:\inetpub\wwwroot\approot\myproject\approot
PS C:\inetpub\wwwroot\approot\myproject\approot> .\web
Error: Unable to load application or execute command 'Microsoft.AspNet.Hosting'. Available commands: web, kestrel.
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 loadContex
t)
   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)

在Windows Server 2012上完成的事情:

  1. 已安装DNVM / DNX
  2. 启用功能IIS&应用程序服务器(对应用程序服务器的选定Web服务器(IIS)支持)
  3. .Net 4.5.2已安装。
  4. DNVM列表输出:

    Active Version           Runtime Architecture OperatingSystem Alias
    ------ -------           ------- ------------ --------------- -----
           1.0.0-rc1-update1 clr     x86          win             default
    

    与我的项目和本地计算机中使用的相同。

    我还从IIS中查找了stdout.log,因为我也尝试使用iis进行设置。但没有运气。并且没有创建或可以找到日志。

    记录project.json

    {
      "webroot": "wwwroot",
      "version": "1.0.0-*",
    
      "dependencies": {
        "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
        "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
        "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
        "Swashbuckle.SwaggerGen": "6.0.0-rc1-final",
        "Swashbuckle.SwaggerUi": "6.0.0-rc1-final",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final"
      },
    
      "commands": {
        "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
        "kestrel": "Microsoft.AspNet.Server.Kestrel",
      },
    
    
      "frameworks": {
        "dnx451": {
          "dependencies": {
            "Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
            "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final"
          }
        },
        "dnxcore50": { }
      },
    
      "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
      ],
      "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
      ]
    }
    

    如果需要其他信息,请告知我们。

1 个答案:

答案 0 :(得分:0)

还不确定为什么,因为我假设发布将包含能够运行的所有内容。但是......我发现了一个决议。

如果你去了Approot> SRC>服务器上的PowerShell中的ProjectName文件夹并运行dnu restore .. web.cmd将突然工作!因为它加载了丢失的包!