2018년 12월 27일 목요일

dotnet core Hello world

ttps://docs.microsoft.com/ko-kr/dotnet/core/linux-prerequisites?tabs=netcore2x

1. 설치  (CentOS 7.5 에서)
dotnet core 2.2 설치
https://docs.microsoft.com/ko-kr/dotnet/core/linux-prerequisites?tabs=netcore2x

다운로드
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm  (리포추가)
sudo yum update  (일단 OS 몽땅 업데이트)
sudo yum install dotnet-sdk-2.2


2. Helloword를 찍어보자

#mkdir /home/www/dotnet/helloworld
#cd /home/www/dotnet/helloworld
[www@dot-netcore-001-talk-svc-jp2v-dev helloworld]$ dotnet new console

Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

ASP.NET Core
------------
Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home1/www/dotnet/helloworld/helloworld.csproj...
  Restoring packages for /home1/www/dotnet/helloworld/helloworld.csproj...
  Generating MSBuild file /home1/www/dotnet/helloworld/obj/helloworld.csproj.nuget.g.props.
  Generating MSBuild file /home1/www/dotnet/helloworld/obj/helloworld.csproj.nuget.g.targets.
  Restore completed in 407.77 ms for /home1/www/dotnet/helloworld/helloworld.csproj.

Restore succeeded.


[www@dot-netcore-001-talk-svc-jp2v-dev helloworld]$ dotnet run
Hello World!

or

[www@dot-netcore-001-talk-svc-jp2v-dev helloworld]$ dotnet ./bin/Debug/netcoreapp2.2/helloworld.dll
Hello World!


수정 후 빌드만 다시하기

[www@dot-netcore-001-talk-svc-jp2v-dev calc]$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 54.51 ms for /home1/www/dotnet/calc/calc.csproj.
  calc -> /home1/www/dotnet/calc/bin/Debug/netcoreapp2.2/calc.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.22


Process 모냥

[www@dot-netcore-001-talk-svc-jp2v-dev ~]$ ps -ef | grep dotnet
www       91284      1  0 14:01 pts/0    00:00:03 /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/2.2.100/Roslyn/bincore/VBCSCompiler.dll -pipename:www.F.4YVjXIkKKf73NaMTt+z4fEXoz
www       93060  90767  1 14:13 pts/0    00:00:00 dotnet run -- kwon
www       93098  93060  0 14:13 pts/0    00:00:00 dotnet exec /home1/www/dotnet/calc/bin/Debug/netcoreapp2.2/calc.dll kwon




high cpu 찾기
top -H -c -b -n1

동작중인 내용잡기
strace -p pid

stack 추출
pstack $pid (high cpu pid)







======================LOG=============================

[root@dot-netcore-001-talk-svc-jp2v-dev:/home1/irteamsu]# sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
Retrieving https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
warning: /var/tmp/rpm-tmp.uHADyq: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:packages-microsoft-prod-1.0-1.el7################################# [100%]


[root@dot-netcore-001-talk-svc-jp2v-dev:/home1/irteamsu]# sudo yum install dotnet-sdk-2.2
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package dotnet-sdk-2.2.x86_64 0:2.2.100-1 will be installed
--> Processing Dependency: aspnetcore-runtime-2.2 >= 2.2.0 for package: dotnet-sdk-2.2-2.2.100-1.x86_64
--> Processing Dependency: dotnet-runtime-2.2 >= 2.2.0 for package: dotnet-sdk-2.2-2.2.100-1.x86_64
--> Running transaction check
---> Package aspnetcore-runtime-2.2.x86_64 0:2.2.0-1 will be installed
---> Package dotnet-runtime-2.2.x86_64 0:2.2.0-1 will be installed
--> Processing Dependency: dotnet-runtime-deps-2.2 >= 2.2.0 for package: dotnet-runtime-2.2-2.2.0-1.x86_64
--> Processing Dependency: dotnet-hostfxr-2.2 >= 2.2.0 for package: dotnet-runtime-2.2-2.2.0-1.x86_64
--> Running transaction check
---> Package dotnet-hostfxr-2.2.x86_64 0:2.2.0-1 will be installed
--> Processing Dependency: dotnet-host >= 2.2.0 for package: dotnet-hostfxr-2.2-2.2.0-1.x86_64
---> Package dotnet-runtime-deps-2.2.x86_64 0:2.2.0-1 will be installed
--> Running transaction check
---> Package dotnet-host.x86_64 0:2.2.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
 Package                            Arch              Version                 Repository                              Size
===========================================================================================================================
Installing:
 dotnet-sdk-2.2                     x86_64            2.2.100-1               packages-microsoft-com-prod            111 M
Installing for dependencies:
 aspnetcore-runtime-2.2             x86_64            2.2.0-1                 packages-microsoft-com-prod             30 M
 dotnet-host                        x86_64            2.2.0-1                 packages-microsoft-com-prod             45 k
 dotnet-hostfxr-2.2                 x86_64            2.2.0-1                 packages-microsoft-com-prod            196 k
 dotnet-runtime-2.2                 x86_64            2.2.0-1                 packages-microsoft-com-prod             27 M
 dotnet-runtime-deps-2.2            x86_64            2.2.0-1                 packages-microsoft-com-prod            2.8 k

Transaction Summary
===========================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 168 M
Installed size: 168 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/packages-microsoft-com-prod/packages/dotnet-host-2.2.0-x64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for dotnet-host-2.2.0-x64.rpm is not installed
(1/6): dotnet-host-2.2.0-x64.rpm                                                                    |  45 kB  00:00:00   
(2/6): dotnet-hostfxr-2.2.0-x64.rpm                                                                 | 196 kB  00:00:00   
(3/6): aspnetcore-runtime-2.2.0-x64.rpm                                                             |  30 MB  00:00:01   
(4/6): dotnet-runtime-2.2.0-x64.rpm                                                                 |  27 MB  00:00:01   
(5/6): dotnet-runtime-deps-2.2.0-rhel.7-x64.rpm                                                     | 2.8 kB  00:00:00   
(6/6): dotnet-sdk-2.2.100-x64.rpm                                                                   | 111 MB  00:00:03   
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                       31 MB/s | 168 MB  00:00:05   
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
 From       : https://packages.microsoft.com/keys/microsoft.asc
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : dotnet-host-2.2.0-1.x86_64                                                                              1/6
Creating dotnet host symbolic link: /usr/bin/dotnet
  Installing : dotnet-hostfxr-2.2-2.2.0-1.x86_64                                                                       2/6
  Installing : dotnet-runtime-deps-2.2-2.2.0-1.x86_64                                                                  3/6
  Installing : dotnet-runtime-2.2-2.2.0-1.x86_64                                                                       4/6
  Installing : aspnetcore-runtime-2.2-2.2.0-1.x86_64                                                                   5/6
  Installing : dotnet-sdk-2.2-2.2.100-1.x86_64                                                                         6/6
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.
  Verifying  : dotnet-hostfxr-2.2-2.2.0-1.x86_64                                                                       1/6
  Verifying  : dotnet-sdk-2.2-2.2.100-1.x86_64                                                                         2/6
  Verifying  : aspnetcore-runtime-2.2-2.2.0-1.x86_64                                                                   3/6
  Verifying  : dotnet-runtime-2.2-2.2.0-1.x86_64                                                                       4/6
  Verifying  : dotnet-runtime-deps-2.2-2.2.0-1.x86_64                                                                  5/6
  Verifying  : dotnet-host-2.2.0-1.x86_64                                                                              6/6

Installed:
  dotnet-sdk-2.2.x86_64 0:2.2.100-1                                                                                     

Dependency Installed:
  aspnetcore-runtime-2.2.x86_64 0:2.2.0-1  dotnet-host.x86_64 0:2.2.0-1              dotnet-hostfxr-2.2.x86_64 0:2.2.0-1
  dotnet-runtime-2.2.x86_64 0:2.2.0-1      dotnet-runtime-deps-2.2.x86_64 0:2.2.0-1

Complete!

댓글 없음:

댓글 쓰기

본 블로그의 댓글은 검토후 등록됩니다.