!!!!NanoServer已死,烧香!!!donnetcore 只支持1.x
入门参考https://docs.microsoft.com/zh-cn/windows-server/get-started/nano-server-quick-start
1、创建VHD
Import-module .\NanoServerImageGenerator.psm1 -Verbose
New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath j:\ -BasePath d:\vm\nano -TargetPath d:\vm\nano\nano.vhd -ComputerName Nano -Package Microsoft-NanoServer-IIS-Package –EnableRemoteManagementPort
2、使用VHD创建虚拟机(在其它操作系统上也可以应用此镜像,如WIN8.1)
3、远程管理
A、连接
Set-Item WSMan:\localhost\Client\TrustedHosts "10.168.1.125"
Enter-PSSession -ComputerName "10.168.1.125" -Credential "administrator"
@@#
B、共享文件夹
参考https://www.cnblogs.com/dotNETCoreSG/p/aspnetcore-2_5-nano_server_on_core.html
以SCSI方式挂载其它虚拟磁盘 参考
Get-Dis
Get-Partition
Set-Disk -Number 1 -IsOffline $false
Set-Disk -Number 1 -IsReadOnly $false
Remove-Partition -DriveLetter D
Set-Partition -DriveLetter E -NewDriveLetter D
mkdir c:\temp
net share AspNetCoreSampleForNano=c:\PublishedApps\AspNetCoreSampleForNano /GRANT:EVERYONE`,FULL
(启用文件共享没什么效果)
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes
netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=yes
net share ShareTemp=c:\temp /GRANT:EVERYONE`,FULL
@@#
C、开端口
参考http://www.pstips.net/manage-firewall-using-powershell.html
New-NetFirewallRule -Name "MyService" -DisplayName "我的服务" -Protocol TCP -LocalPort 80,8080,3413-3420 -Action Allow -Enabled True
D、安装NET CORE
参考https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
./dotnet-install.ps1 -Channel 2.0 -InstallDir C:\cli
如果提示错误
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
IIS
参考 https://www.cnblogs.com/dotNETCoreSG/p/aspnetcore-2_5-nano_server_on_core.html
下载安装脚本,执行命令
自服务
参考https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-2.1
Cmd /c sc create MyService binPath= "c:\temp\publish\WebApplication2.exe" start= auto
Cmd /c sc start MyService
(使用独立发布,安装了2.0框架,在CENTOS中安装了2.1,独立发布出现DLL的版本签名不一致,最终使用框架依赖发布)
public class Program { public static void Main(string[] args) { // BuildWebHost(args).Run(); CreateWebHostBuilder(args).RunAsService(); }
public static IWebHost BuildWebHost(string[] args) //WebHost.CreateDefaultBuilder(args) // .UseStartup<Startup>() // .Build(); { //在IIS启动 var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("hosting.json", optional: tr |
首页 上一页 1 2 下一页 尾页 1/2/2 | |
【大 中 小】【打印】 【繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部】 | |
上一篇:Windows server 2008 R2配置多个.. | 下一篇:Windows 2008 R2 域控制器迁移至w.. |