dnx web error 500 when try to execute

余生长醉 提交于 2019-12-12 02:24:10

问题


I'm trying to execute in a Mac (El Capitán), the MusicStore example in ASP.NET from the official repository.

I have tested it using mono and core, switching in dnvm, but no results. The dnu build is working fine with mono, with core, the build fails.

When I execute dnx web, all works fine, but when I execute the project (firs load), I have a 500 error, with this error:

An unhandled exception has occurred: Unable to resolve service for type 'Microsoft.Extensions.CompilationAbstractions.ILibraryExporter' while attempting to activate 'Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService'.

I have changed all possibilities (Mono and Core), but I have no idea where is the problem... and I have read this question with no results

Project JSON Added

{
"authors": [
    "Microsoft"
],
"description": "Music store application on ASP.NET 5",
"version": "1.0.0-*",
"compilationOptions": { "warningsAsErrors": true, "define": [ "DEMO", "TESTING" ] },
"compile": [
    "../../shared/**/*.cs"
],
"publishExclude": "*.cmd",
"webroot": "wwwroot",
"dependencies": {
    "EntityFramework.InMemory": "7.0.0-*",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-*",
    "Microsoft.AspNet.Antiforgery": "1.0.0-*",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*",
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-*",
    "Microsoft.AspNet.Authentication.Google": "1.0.0-*",
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-*",
    "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*",
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-*",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*",
    "Microsoft.AspNet.Mvc": "6.0.0-*",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*",
    "Microsoft.AspNet.Server.IIS": "1.0.0-*",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-*",
    "Microsoft.AspNet.Session": "1.0.0-*",
    "Microsoft.AspNet.StaticFiles": "1.0.0-*",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-*",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-*",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-*"
},
"commands": {
    "gen": "Microsoft.Extensions.CodeGeneration",
    "run": "run server.urls=http://localhost:5003",
    "web": "Microsoft.AspNet.Server.Kestrel",
    "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5004",
    "weblistener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002"
},
"frameworks": {
    "dnx451": { },
    "dnxcore50": {
        "dependencies": {
            "System.Runtime.Serialization.Primitives": "4.0.10-*"
        }
    }
}

}

Thanks!!

dnvm list (command result) I have tested with Mono and Core...


回答1:


Note: Ensure to get the rc1 version of the Music Store

The main process to making the application work once everything is working is to make sure that your runtime is on the latest version of the feed (in this case, Nuget.org).

Nuget.org at the moment is at rc1-final. So you'll need the rc1-final/rc1-update1 to run it properly. (Which is ok for you)

Once this is done, we're ready to restore packages for the application.

  • dnu restore for the DNX runtime

And in other scenarios (not the MusicStore in this case), you'll need to run npm install and bower install.

Once everything is updated, you can run dnx web at the same level as the project.json and it should run.



来源:https://stackoverflow.com/questions/34201252/dnx-web-error-500-when-try-to-execute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!