此文用于记录在win10环境下,新建的Asp.net Core 2.0 Web应用项目如何运行在IIS上
一、运行环境
操作系统: Window10 家庭中文版 版本 10.0.15063 版本 15063
IDE: Visual Studio Community 2017
Net Core 2.0
二、确定IIS是否有安装Core 2.0模块
因为Asp.net Core 2.0是不需要应用程序池托管的,所以先要安装CoreModule在IIS上用于转发
托管 ASP.NET Core 应用有多种方式,即可在传统的windows平台,也可以部署在开源的Linux上,还可以通过docker容器来部署


如果没有,需要点击此处 下载Core SDK和Windows Server Hosting (.exe) ,具体位置如下图

下载完成后安装即可,其中Core SDK安装后需要重启电脑
三、发布Asp.net Core 2.0 Web 应用
新建一个Asp.net Core 2.0 Web 应用,右键项目-发布



打开IIS添加应用程序池,这里注意一定要选择【无托管代码】


这次应该是失败的

这个失败是因为没有IIS权限进入目录读取到文件,所以我们进入到相关的目录为其添加Everyone控制
文件目录可以查看发布页面,如下图

右击目录为其添加Everyone权限,流程如下图




四、再次浏览IIS网站
大功告成
五、后记
昨晚(20180107)才安装完成的VS2017,就迫不及待地尝试新的Asp.net Core Web项目
ASP.NET Core 是一个跨平台的高性能开源框架,暂时我还找不到如何不发布就能在IIS上跑起来,这样对于调试来说好像是有点不太方便.(毕竟每次查看localhost都要发布一次,而且要停止网站才能正常发布)
未解决的问题:在新建的Web应用程序中(非MVC),发布后会自动引用CDN中的jquery文件,由于不能正常连接CDN网址而导致样式不能使用。
如果有空的话,本文应该还会更新吧。
网友评论