斜面运行默认ASP.NET Web应用程序在Visual Studio code为Mac [英] Cant Run Default ASP.NET Web App In Visual Studio Code for Mac
问题描述
刚刚启动与Visual Studio code ASP.NET项目在Mac
Just starting up an ASP.NET project with Visual Studio Code on a Mac
我已经通过所有常规步骤,与圆满完成了 DNU恢复
命令结束。
I've been through all the usual steps, ending with the dnu restore
command which completed successfully.
我然后运行 DNX网站
,我得到一个正在运行的本地主机:5000 - 但是当我浏览到该地址没有任何内容。
I then run dnx web
and I get a running localhost:5000 - but when I browse to that address there is no content.
在终端窗口中,我可以看到下面的错误(对不起,我没有包括所有的,因为它是相当详细)。
In the terminal window I can see the error below (sorry I haven't included all of it as it's quite verbose).
info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
User profile is available. Using '/Users/deanchalk/.local/share/ASP.NET/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNet.Hosting.Internal.HostingEngine[1]
Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker[1]
Executing action method firstmacaspnetapp.Controllers.HomeController.Index with arguments () - ModelState is Valid'
fail: Microsoft.AspNet.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Unable to resolve service for type 'Microsoft.Dnx.Compilation.ILibraryExporter' while attempting to activate 'Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService'.
System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Dnx.Compilation.ILibraryExporter' while attempting to activate 'Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.PopulateCallSites (Microsoft.Extensions.DependencyInjection.ServiceProvider provider, ISet`1 callSiteChain, System.Reflection.ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) [0x00000] in <filename unknown>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.CreateCallSite (Microsoft.Extensions.DependencyInjection.ServiceProvider provider, ISet`1 callSiteChain) [0x00000] in <filename unknown>:0
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetResolveCallSite (IService service, ISet`1 callSiteChain) [0x00000] in <filename unknown>:0
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetServiceCallSite (System.Type serviceType, ISet`1 callSiteChain) [0x00000] in <filename unknown>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.PopulateCallSites (Microsoft.Extensions.DependencyInjection.ServiceProvider provider, ISet`1 callSiteChain, System.Reflection.ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) [0x00000] in <filename unknown>:0
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.CreateCallSite (Microsoft.Extensions.DependencyInjection.ServiceProvider provider, ISet`1 callSiteChain) [0x00000] in <filename unknown>:0
我周围的一派,找不到任何信息。
I've googled around and cannot find any info.
我project.json看起来是这样的:
My project.json looks like this:
{
"version": "1.0.0-*",
"userSecretsId": "aspnet5-firstmacaspnetapp-88915393-5f54-4e2d-9285-912b92370fb0",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "firstmacaspnetapp"
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.SQLite": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"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.Dnx.Runtime":"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"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [
"npm install",
"bower install",
"gulp clean",
"gulp min"
]
}
}
有没有人有什么想法?
Does anyone have any ideas ?
推荐答案
所以,我得到这个错误,以及当我在我的Mac上设置我的asp.net项目。我通过升级单固定它(如果这就是你正在使用的图书馆。核心应该,如果您使用的是升级)。要进行升级,使用单声道从终端:
So, I got this error as well when I was setting up my asp.net project on my Mac. I fixed it by upgrading Mono (if that's the library you are using. Core should be upgraded if you are using that). To upgrade, use this for mono from terminal:
dnvm升级-r单
使用此升级从终端核心:
Use this to upgrade core from terminal:
dnvm升级-r coreclr
dnvm upgrade -r coreclr
然后我跑去 DNU恢复
只是要确定,然后 DNX网站
,我能够把它拉起来在的http://本地主机:5000 /
I then ran dnu restore
just to be sure and then dnx web
and I was able to pull it up on http://localhost:5000/
请注意:我做了所有的其他升级首,所以这可能是最后的问题(如果你知道我的意思)。值得一试,虽然,它为我工作。
Note: I made all of the other upgrades first, so this may have been the last problem (if you know what I mean). Worth a shot though, and it worked for me.
这篇关于斜面运行默认ASP.NET Web应用程序在Visual Studio code为Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!