自从知道微软用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命令:

$ 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

原以为大功告成了,结果却是在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上尝试了。

尝试在mac上用dotnet cli运行asp.net core示例程序的更多相关文章

  1. .NET跨平台:在CentOS上编译dnx并运行ASP.NET 5示例程序

    在之前的博文中我们在 Ubuntu 上成功编译出了 dnx ,并且用它成功运行了 ASP.NET 5 示例程序.在这篇博文中我们将 Ubuntu 换成 CentOS. 目前 dnx 的编译需要用到 m ...

  2. 在Mac下运行ASP.NET Core应用程序

    在Mac下运行ASP.NET Core应用程序 通过参照.NET Core相关官方文档,在我的Mac电脑上用Visual Studio Code创建了我的第一个ASP.NET应用. 开发环境搭建 首先 ...

  3. Mac下运行ASP.NET Core应用程序

    Mac下运行ASP.NET Core应用程序 在Mac下运行ASP.NET Core应用程序 通过参照.NET Core相关官方文档,在我的Mac电脑上用Visual Studio Code创建了我的 ...

  4. .NET跨平台:在Ubuntu上用自己编译的dnx运行ASP.NET 5示例程序

    在 Linux Ubuntu 上成功编译 dnx 之后,会在 artifacts/build/ 文件夹中生成 dnx-coreclr-linux-x64/ 与 dnx-mono/ 这2个文件夹,前者是 ...

  5. ASP.NET Core 中文文档 第二章 指南(8) 使用 dotnet watch 开发 ASP.NET Core 应用程序

    原文:Developing ASP.NET Core applications using dotnet watch 作者:Victor Hurdugaci 翻译:谢炀(Kiler) 校对:刘怡(Al ...

  6. 使用 dotnet watch 开发 ASP.NET Core 应用程序

    使用 dotnet watch 开发 ASP.NET Core 应用程序 原文:Developing ASP.NET Core applications using dotnet watch作者:Vi ...

  7. 基于阿里云容器服务用docker容器运行ASP.NET 5示例程序

    小试阿里云容器服务 之后,接下来有一个挡不住的小试冲动--用docker容器运行程序.首先想到的程序是 ASP.NET 5示例程序,于是参考msdn博客中的这篇博文 Running ASP.NET 5 ...

  8. 在Linux上用自己编译出来的coreclr与donet cli运行asp.net core程序

    先在 github 上签出 coreclr 的源代码,运行 ./build.sh 命令进行编译,编译结果在 coreclr/bin/Product/Linux.x64.Debug/ 文件夹中. 接着签 ...

  9. 在Mac上开发使用yeoman构建Asp.net core项目并且实现分层引用

    1.Yeoman? yeoman是一个自动化脚手架工具.它提供很多generator,generator相当于VisualStudio的模板,用来初始化项目.更多的就不多说了,写一遍都写不完,自己看吧 ...

随机推荐

  1. Reactjs 入门基础(三)

    State 和 Props以下实例演示了如何在应用中组合使用 state 和 props .我们可以在父组件中设置 state, 并通过在子组件上使用 props 将其传递到子组件上.在 render ...

  2. jenkins+findbugs

    1)  Jenkins安装findbugs插件 具体安装步骤:在主页面进入系统管理 选择插件管理 在过滤器中找出要安装的插件,并进行安装(Static Analysis Utilities.findb ...

  3. APP弱网测试

    APP弱网测试   App弱网测试方法,常用工具有使用fiddler进行网络模拟,也可以使用Network Emulator Toolkit控制模拟网络,相对来说Network Emulator To ...

  4. JavaWeb总结--Servlet 工作原理解析

    从 Servlet 容器说起 要介绍 Servlet 必须要先把 Servlet 容器说清楚,Servlet 与 Servlet 容器的关系有点像枪和子弹的关系,枪是为子弹而生,而子弹又让枪有了杀伤力 ...

  5. centos7 ip地址设置

    centos7 ip地址设置 http://simonhu.blog.51cto.com/196416/1588971 CentOS系统 修改DNS 修改对应网卡的DNS的配置文件 # vi /etc ...

  6. WordPress建站指南

    WordPress建站指南(1)   写在前面: 3月份用10天零碎时间火速完成了建站,后台95%的工作都交给了WP(WordPress).如果想偷懒的话,WP是一个绝好的选择,估计有个小半天就建完收 ...

  7. mysql convert

    SELECT id,boshidianshu,boshidianshu_shuzi,CONVERT(REPLACE(boshidianshu, '个', ''),SIGNED) aaa from lg ...

  8. Linux下守护进程初探

    守护进程一直后台运行,与终端脱离,一般负责周期性地执行系统任务,服务器应用一般以守护进程进行运行.实现一个守护进程主要分为5部: 1.脱离父进程 2.setsid(可以选择再次fork) 3.umas ...

  9. WPF中获得控件相对于控件的相对位置

    GeneralTransform generalTransform = lstitem.TransformToAncestor(this.BackStack); Point point = gener ...

  10. 高并发访问mysql时的问题(一):库存超减

    如果在对某行记录的更新时不采取任何防范措施,在多线程访问时,就容易出现库存为负数的错误. 以下用php.mysql,apache ab工具举例说明: mysql表结构 CREATE TABLE `yx ...