MVC 6 Windows Server 2012 R2 IIS 8.5 - Error: Unab

2019-09-02 19:49发布

问题:

When trying to deploy a MVC 6/ASP.NET 5 application to IIS I get the error

Error: Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web, ef.

in the stdout log file.

I published the application using Visual Studio 2015 and it runs ok if I call web.cmd directly in a command prompt.

My project.json file looks like

{
  "userSecretsId": "aspnet5-H3CustomerPortal-2b9cfc76-487a-41dc-a29f- c81e45251c25",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0- rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "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",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-final"
  },

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

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

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean",  "gulp   min" ]
  }
}

The runtime is dnx-clr-win-x64.1.0.0-rc1-update1, the server is Windows Server 2012 R2 with IIS 8.5. I have installed the HTTP platform handler 1.2. Is there anything else that needs installed for this to work in IIS? Or any additional configuration/environment variables that need set? Any help would be appreciated. Thanks

回答1:

The solution from this post worked Problems publishing asp vnext website on IIS 8 i.e. ASP 4.5 wasn't installed, to install it go to Server Manager , Add Roles and Features, Web Server IIS / Web Server / Application Development and check ASP .NET 4.5 and .NET Extensibility 4.5