尝试在mac上用dotnet cli运行asp.net core示例程序
2016-02-26 23:35
841 查看
自从知道微软用dotnet cli取代dnx之后,一直在等dotnet cli支持asp.net core。。。
昨天看到这篇新闻(ASP.NET Core 1.0 Hello World)后,才知道原来dotnet cli早就支持asp.net core了,而且在github上有专门的示例程序。
于是,立马想在mac上体验一下。
首先去 http://dotnet.github.io/getting-started/ 下载并安装mac版的dotnet cli —— dotnet-osx-x64.latest.pkg。安装成功之后,就可以在terminal中运行dotnet命令:
然后用git命令从github上签出 https://github.com/aspnet/cli-samples
然后运行dotnet restore命令安装nuget包包,出现了错误:
出现这个问题是由于我电脑上的openssl版本低(OpenSSL 0.9.8),dotnet cli需要的版本是OpenSSL 1.0.1或1.0.2。用homebrew安装最新版的openssl:
安装之后,虽然openssl version显示的还是0.9.8,但这时dotnet restore命令已经可以正常运行了。
昨天看到这篇新闻(ASP.NET Core 1.0 Hello World)后,才知道原来dotnet cli早就支持asp.net core了,而且在github上有专门的示例程序。
于是,立马想在mac上体验一下。
首先去 http://dotnet.github.io/getting-started/ 下载并安装mac版的dotnet cli —— dotnet-osx-x64.latest.pkg。安装成功之后,就可以在terminal中运行dotnet命令:
$ dotnet .NET Command Line Tools (1.0.0-beta-001556) Usage: dotnet mmon-options] mmand] guments]
然后用git命令从github上签出 https://github.com/aspnet/cli-samples
git clone https://github.com/aspnet/cli-samples cd cli-samples
然后运行dotnet restore命令安装nuget包包,出现了错误:
dotnet restore log : Restoring packages for /Git/dotnet/cli-samples/HelloMvcApi/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloWebFull/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloMvc/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloWeb/project.json... error: The type initializer for 'Crypto' threw an exception. error: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found. error: (Exception from HRESULT: 0x8007007E)
出现这个问题是由于我电脑上的openssl版本低(OpenSSL 0.9.8),dotnet cli需要的版本是OpenSSL 1.0.1或1.0.2。用homebrew安装最新版的openssl:
brew install openssl
安装之后,虽然openssl version显示的还是0.9.8,但这时dotnet restore命令已经可以正常运行了。
log : Restoring packages for /Git/dotnet/cli-samples/HelloWebFull/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloMvcApi/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloWeb/project.json... log : Restoring packages for /Git/dotnet/cli-samples/HelloMvc/project.json... info : GET https://www.myget.org/F/aspnetcidev/api/v3/flatcontainer/netstandard.library/index.json[/code] 原以为大功告成了,结果却是在dotnet restore期间nuget包包总是安装失败,比如出现下面的错误:error: Failed to download package from 'https://www.myget.org/F/aspnetcidev/api/v3/flatcontainer/microsoft.aspnetcore.iisplatformhandler/1.0.0-rc2-16280/microsoft.aspnetcore.iisplatformhandler.1.0.0-rc2-16280.nupkg'. error: The HTTP request to 'GET https://myget-2e16.kxcdn.com/privatefeedaspnetcidev/Microsoft.AspNetCore.IISPlatformHandler-1.0.0-rc2-16280?sv=2014-02-14&sr=b&sig=ARjy3JzGc36F5tS6EyvjEQWpI0JHL56vOkiJW8U9LV8%3D&st=2016-02-26T13:55:00Z&se=2016-02-26T15:05:00Z&sp=r&rscc=max-age%3D3600&rsct=binary%2Foctet-stream&rscd=filename%3DMicrosoft.AspNetCore.IISPlatformHandler.1.0.0-rc2-16280.nupkg' has timed out after 100000ms.
奇怪的是,不能安装的包包,通过浏览器或curl命令都能下载。而在linux电脑上没这个问题,dotnet restore一切正常,dotnet run轻松将asp.net core示例站点运行了起来。算了,直接在linux上折腾吧,暂时不在mac上尝试了。
相关文章推荐
- 关于aspx 页面生成html 源码顶部空行不得不说的事儿
- asp.net IIS7 503错误
- 实现Asp.Net Mvc4多级Views目录
- aspv6_index
- 解决Asp.net Mvc返回JsonResult中DateTime类型数据格式的问题
- ASP.NET MVC RouteExistingFiles
- asp.net程序中如何使用皮肤更换的小功能
- ASP.NET内置对象的总结
- Asp.net Mvc4默认权限详细(下)
- 转:Asp.net Mvc4默认权限详细(上)
- controller向view传值的几种方法
- asp.net中缓存的使用
- asp.net DropDownList实现二级联动效果
- ASP.NET AJAX
- asp.net生成字母和数字混合图形验证码
- AspNet5.ENU.RC1安装错误:0x80072f0d - 未指定的错误
- asp.net生成字母和数字混合图形验证码
- asp.net DropDownList实现二级联动效果
- Raspberry pi 定时天气播报
- 【ASP.Net】使用ICallbackEventHandler实现无刷新回调