點擊你要發布項目,注意不是解決方案!
右擊 TRS.Web.Admin ,點擊 發布 后,
選取發布目標 點擊文件夾,自定義文件路徑或默認路徑都可以
點擊 高級
點擊保存后,直接 發布 即可
當項目發布好之后,首先需要查看一下電腦上IIS有沒有配好。
本地部署(IIS)
(1)開始→控制面板→程序→啟用或關閉Windows功能
把屬於IIS的全部勾選上,避免出現錯誤不好解決
(2)開始→(IIS)管理器
(3)右擊 網站 → 添加站點
1)網站名稱自己起,可以隨便定義;
2)物理路徑,選擇VS發布好的那個文件夾即可
3)如果不選擇主機名,IP可以默認不選,端口號默認為:80
4)主機名為網站的名稱(這個需要在C盤下配置)
主機名配置
首先,找到你的文件:C:\Windows\System32\drivers\etc的hosts文件,直接用記事本打開
文件內容如下

1 # 2 3 4 # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 5 6 7 # 8 9 10 # This file contains the mappings of IP addresses to host names. Each 11 12 13 # entry should be kept on an individual line. The IP address should 14 15 16 # be placed in the first column followed by the corresponding host name. 17 18 19 # The IP address and the host name should be separated by at least one 20 21 22 # space. 23 24 25 # 26 27 28 # Additionally, comments (such as these) may be inserted on individual 29 30 31 # lines or following the machine name denoted by a '#' symbol. 32 33 34 # 35 36 37 # For example: 38 39 40 # 41 42 43 # 102.54.94.97 rhino.acme.com # source server 44 45 46 # 38.25.63.10 x.acme.com # x client host 47 48 49 # localhost name resolution is handled within DNS itself. 50 51 52 # 127.0.0.1 localhost 53 54 55 # ::1 localhost 56 57 58 #123.151.26.11 wt2-new-rso.lol.qq.com 59 # IP地址 主機名 60 192.168.3.104 admin.zhujiajiao66.com 61 192.168.3.104 cSharp.zhujiajiao67.com
打開之后直接在HOSTS文件中加入一行
如:
# IP地址 主機名
192.168.3.104 admin.zhujiajiao66.com
取消時,在配置行前加上 #