自从知道微软用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. Nginx配置文件(nginx.conf)配置详解

    Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目 ...

  2. spark streaming 实战

    最近在学习spark的相关知识, 重点在看spark streaming 和spark mllib相关的内容. 关于spark的配置: http://www.powerxing.com/spark-q ...

  3. python-函数中定义可变参数

    可变参数 在Python函数中,还可以定义可变参数.顾名思义,可变参数就是传入的参数个数是可变的,可以是1个.2个到任意个,还可以是0个. 我们以数学题为例子,给定一组数字a,b,c……,请计算a2 ...

  4. 奇怪的margin,padding,table

    为什么有的时候margin,padding不管用?写了float以后就管用了? 为什么table 不给width,就默认是100%,里面的td会平均分配teble的宽度,若你想给其中一些td宽度,剩下 ...

  5. Selenium2+python自动化18-加载Firefox配置

    前言 有小伙伴在用脚本启动浏览器时候发现原来下载的插件不见了,无法用firebug在打开的页面上继续定位页面元素,调试起来不方便 . 加载浏览器配置,需要用FirefoxProfile(profile ...

  6. C# upnp

    //获取Host Name var name = Dns.GetHostName(); Console.WriteLine("用户:" + name); //从当前Host Nam ...

  7. java多线程学习-开篇

    1.Java线程基本概念 在操作系统中两个比较容易混淆的概念是进程(process)和线程(thread).操作系统中的进程是资源的组织单位.进程有一个包含了程序内容和数据的地址空间,以及其它的资源, ...

  8. JSON的故事

    1.介绍JSON http://www.json.org/ https://developer.mozilla.org/zh-CN/docs/JSON 2.json的序列化和反序列化 序列化方法 va ...

  9. ubuntu14.04 的网络配置

    为eth0 配置网络 vi /etc/network/intefaces 添加以下内容 auto eth0 iface eth0 inet static address 192.168.0.10 ne ...

  10. 問題排查:.NETSystem.Runtime.Remoting.RemotingException: TCP 信道协议冲突: 应为报头。

    這個錯誤訊息是在一個 Web Serveice 的偵錯階段發生的 目前還未找到原因,環境如下: 作業系統:Windows 10 x64 企業版 (簡中) 開發工具:Visual Studio 2013 ...