简体   繁体   中英

Run Asp.net 5 vNext project (MVC6) publish build on Windows Server 2012 R2

I configurated everything according to some resources on the internet, but i don't know what i miss..

When i try to start it manually (Which works on my local computer!) i get the following result on the server:

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)

Things done on Windows Server 2012:

  1. Installed DNVM/DNX
  2. Enabled features IIS & Application server (Selected Web server (IIS) Support for the application server as well)
  3. .Net 4.5.2 is installed.

DNVM list outputs:

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

Which is the same as used in my project and local computer.

I also looked for the stdout.log from IIS as i also tried setting it up with iis. but no luck. And no log is created or can be found.

For the record the 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"
  ]
}

If additional information is required please let me know.

Not sure why yet, as i assume that a publish will contain everything to be able to run. But.. i found an resolution.

If you go to the Approot > SRC > ProjectName folder in powershell on the server and run dnu restore.. the web.cmd will suddenly work! As it loads the missing packages!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM