最新版本号[免费下载]

在windows IIS服务商配置asp.net core的服务器坏境,并部署

作者:本站编辑 发布时间:2018-12-20 来源:佚名 点击数:

翻译自https://docs.microsoft.com/en-us/aspnet/core/publishing/iis 

另一篇参考的文章

http://www.c-sharpcorner.com/uploadfile/2b481f/how-to-host-asp-net-web-api-on-iis-server/ 

支持的操作系统:

windows 7或更新

windows server 2008 R2或更新

IIS配置

使能Web server并配置相关选项

windows桌面版系统

1.png

windows server版操作系统

2.png

3.png

 

 安装.net core windows server托管工具包

1. 安装.NET Core Windows Server Hosting bundle: https://aka.ms/dotnetcore.2.0.0-windowshosting

  如果服务器没有连接互联网,应在安装hosting bundle前下载安装 microsoft visual c++ redistributable https://www.microsoft.com/download/details.aspx?id=53840

2. 重新启动系统或执行

    >net stop was /y

   >net start w3svc

 用visualstudio发布时安装Web Deploy

 如果你希望在vs内用Web Deploy来部署你的应用,请在主机系统上安装最新版的Web Deploy。 

要安装Web Deploy,你可以使用Web Platform Installer(WebPI) https://www.microsoft.com/web/downloads/platform.aspx

或直接从微软下载中心下载 (https://www.microsoft.com/search/result.aspx?q=webdeploy&form=dlc)(注链接不能用)

应用配置

1. 使能IISIntegration component

  包含依赖项 Microsoft.AspNetCore.Server.IISIntegration

  Program.cs中加入一下代码

复制代码

var host = new WebHostBuilder()
    .UseKestrel()
    .UseContentRoot(Directory.GetCurrentDirectory())
    .UseIISIntegration()
    .UseStartup<Startup>()
    .Build();

复制代码

2. 配置IISOptions 

3. web.config

 

创建IIS网站

(注:这一步可以参照逐浪CMS的基础配置教程,详见www.z01.com/mtv 以及 逐浪IIS智能工具http://help.z01.com/tool/  )


本文责任编辑: 加入会员收藏夹 点此参与评论>>
复制本网址-发给QQ/微信上的朋友
AI智能听书
选取音色