6

I am trying to deploy my ASP.NET 5 WebApi to a remote server (Windows server 2008 R2) and am having trouble getting it to run correctly with IIS.

project.json

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "App.Data": "1.0.0-*",
    "App.Model": "1.0.0-*",
    "App.Repository": "1.0.0-*",
    "App.ViewModel": "1.0.0-*",
    "AutoMapper": "4.1.1",
    "Microsoft.AspNet.Authentication": "1.0.0-rc2-16009",
    "Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc2-16009",
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc2-16136",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc2-15873",
    "Microsoft.AspNet.Mvc": "6.0.0-rc2-16377",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc2-16017",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-rc2-15932",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc2-15916",
    "Microsoft.Framework.Configuration.Json": "1.0.0-rc1-15666",
    "Microsoft.Framework.Logging": "1.0.0-rc1-15644",
    "Microsoft.Framework.Logging.Console": "1.0.0-rc1-15644",
    "Microsoft.IdentityModel.Protocols.OpenIdConnect": "2.0.0-rc1-211120828"
  },

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

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

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

when I try to access to the application from the browser, I get no response. And when I execute web.cmd on the server, I get the following error:

Error: Unable to load application or execute command 'Microsoft.AspNet.Server.Ke
strel'. Available commands: kestrel, web.
System.IO.FileNotFoundException: Le fichier spécifié est introuvable. (Exception
 de HRESULT : 0x80070002)
   à System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)

   à System.Reflection.Assembly.LoadFile(String path)
   à Microsoft.Dnx.Runtime.Loader.LoadContext.LoadFile(String assemblyPath)
   à Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemb
lyName, IAssemblyLoadContext loadContext)
   à Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemb
lyName)
   à Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
   à Microsoft.Dnx.Host.DefaultLoadContext.LoadAssembly(AssemblyName assemblyNam
e)
   à Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name
, Func`2 factory)
   à Microsoft.Dnx.Runtime.Loader.LoadContext.LoadAssemblyImpl(AssemblyName asse
mblyName)
   à Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, Res
olveEventArgs args)
   à System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String as
semblyFullName)

Thank you for your help

DavidG
  • 113,891
  • 12
  • 217
  • 223
Amine
  • 1,198
  • 11
  • 19
  • 1. Do not mix rc1 and rc2 packages. That's a recipe for disaster :) 2. What DNX version do you use? – Victor Hurdugaci Nov 17 '15 at 14:50
  • Thank you for your reply. I'm using 1.0.0-rc2-16177 clr x86 version. The application runs very well on IIS Express! – Amine Nov 17 '15 at 15:09
  • I just saw something that looks like this a moment ago myself... did you run `dnvm upgrade`? That fixed it for me. – Alex C Dec 01 '15 at 05:24

1 Answers1

22

Make sure you have all the dependencies installed on target server. Run dnu list in cmd to see all the project dependencies.

If some of them are not installed (they will appear red) run dnu restore to restore all packages.

You can also make sure that your project builds successfully by running dnu build

Hope it helps..

Jan Deutschl
  • 561
  • 2
  • 14