Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 46. .NET Service Bus 응용 사례: SocketShifter [링크 복사], [링크+제목 복사],
조회: 21591
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
(연관된 글이 3개 있습니다.)
.NET Service Bus 응용 사례: SocketShifter


처음 .NET ServiceBus를 알게 된 것이 다음의 MSDN Magazine 글 덕분이었습니다.

Foundations - Working With The .NET Service Bus
; https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/april/working-with-the-net-service-bus

글을 읽어보시면, 아주 매력적인 기능이 하나가 눈에 뜨일 텐데요. 설명보다는 글 안에 포함된 다음의 그림을 보시면 금방 이해가 되실 것입니다.

[그림 1: Relay Service 구조]
netservicebus_sample_1.gif

와~~~! 멋지죠. 이 서비스는 다음의 HTTPort/HTTHost 서비스와 유사한 기능을 제공하고 있습니다.

TCP through HTTP tunneling: 기업내 Proxy 서버 제한에서 벗어나는 방법 
; https://www.sysnet.pe.kr/2/0/118

즉, 이것을 잘 이용하면 사설망에서 서비스하고 있는 소켓 서비스를 마이크로소프트 측에서 제공하는 컴퓨터를 중계기로 하여 외부망으로부터 자유롭게 접속하는 것이 가능합니다.

그럼... 어떻게 활용해 보는 것이 좋을까요?
아래의 글에서는 이에 대한 ^^ 훌륭한 활용 예를 보여주고 있습니다.

.NET Service Bus - Remote Desktop over Firewalls!
; http://blogs.southworks.net/mwoloski/2009/07/10/net-service-bus-remote-desktop-over-firewalls/

우와~~~! 이 말은 곧, 사설 IP를 받은 회사의 컴퓨터를 집에서도 VPN 없이 Remote Desktop 연결을 할 수 있다는 것입니다. 멋지지 않나요? ^^

아쉬운 점이 있다면, .NET Service Bus 서비스가 무료로 전세계 사람들에게 제공할 수는 없기 때문에 이 프로그램을 활용하기 위해서는 각자가 "Microsoft .NET Services"에 가입해서 Relay Service를 받기 위한 환경을 설정해 놓아야 한다는 것입니다.

그럼,,, 한번 설정 과정을 따라가 볼까요?




이전에도 말씀드렸듯이, 중계 서비스는 현재 주도적으로 무료(또는 유료)로 제공되는 곳이 없기 때문에 각자가 "Microsoft .NET Services"에 가입해서 자신만의 솔루션 구성을 해줘야 합니다.

이를 위해 다음의 URL을 방문하고,

Azure 서비스 등록
Azure Services Platform .NET Services
; http://www.microsoft.com/azure/netservices.mspx

Live 로그인 후 등록 과정을 거칩니다.

Register for Azure Services 
; http://go.microsoft.com/fwlink/?LinkID=129453

그다음, Azure 서비스 중에서도 ".NET Services"로 로그인을 해서 들어갑니다.

.NET Services
Microsoft .NET Services 
; http://portal.ex.azure.microsoft.com/

"Add Solution" 메뉴를 이용해서 중계 서비스로 사용할 솔루션을 임의의 이름으로 하나 만듭니다. 저 같은 경우에는 "rdTicket"이라는 이름으로 만들었습니다. 솔루션을 만들면 곧바로 사용 가능하지 않습니다. 잠시 시간이 흐른 후, 새로 고침으로 방문을 하고 나서야 아래와 같이 "Status"가 "Active" 상태로 바뀝니다.

[그림 2: rdTicket 솔루션 생성 화면]
netservicebus_sample_2.png

이제, 우측 하단의 "Credentials" 링크를 누르고, 전환되는 화면에서 "Solution Password" 링크를 누르면 다음과 같이 솔루션의 접근 암호를 설정할 수 있는 화면이 나옵니다. 적절하게 입력하십시오.

[그림 3: rdTicket 솔루션의 암호 설정]
netservicebus_sample_3.png

"솔루션 이름"과 "암호"는 다음 단계에서 사용하기 때문에 기억해 두십시오.




다음으로, 서버 측 환경을 구성해 봅니다.

원격 터미널 서비스를 제공하는 Windows Server 2008(또는 그 외의 터미널 서비스를 제공하는 윈도우즈) 서버에 다음의 SDK를 다운로드해 설치합니다.

Microsoft .NET Services SDK (July 2009 CTP)
; http://www.microsoft.com/downloads/details.aspx?FamilyID=38d8cf79-fc39-4aef-b3fd-ef280f2e9fa6&displaylang=en

Codeplex 사이트에 방문해서 다음의 링크에서 SocketShifter 소스 코드를 다운로드 받습니다. (우측에 "Latest Version"의 "Download" 링크를 클릭하면 됩니다.)

SocketShifter - Source Code (이 글의 첨부 파일에도 올렸습니다.)
; http://socketshifter.codeplex.com/SourceControl/ListDownloadableCommits.aspx

다운로드한 소스를 Visual Studio에서 열어서, SocketShifterServer 프로젝트의 app.config을 열면 다음과 같은 내용이 있는데,

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="solutionName" value="[솔루션 이름]"/>
    <add key="password" value="[솔루션 비밀번호]"/>
    <add key="servicePath" value="sb://[솔루션 이름].servicebus.windows.net/[임의의 이름]"/>
    <add key="allow" value="localhost:3389"/>
  </appSettings>
</configuration>

조금 전에 설정해 둔 .NET Services 솔루션 이름과 비밀번호를 입력하고, "servicePath"도 적절하게 변경시켜 줍니다. 저 같은 경우에는 솔루션 이름이 "rdTicket"이었기 때문에 servicePath를 다음과 같이 임의로 결정했습니다.

servicePath: sb://rdTicket.servicebus.windows.net/rd

이제 빌드를 하면 정상적으로 exe 파일이 나오는데 이를 NT 서비스로 등록하기 위해서 "Visual Studio 2008 명령행"을 실행하고 다음과 같이 InstallUtil을 이용해서 설치를 해줍니다.

C:\test\socketshifter-27275\SocketShifterServer\bin\Debug>installutil SocketShifterServer.exe
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (C) Microsoft Corporation. All rights reserved.


트랜잭트 설치를 실행하고 있습니다.

설치의 Install 단계를 시작하고 있습니다.
C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe 어셈블리의 진행 상황을 보려면 로그 파일 내용을
검토하십시오.
파일은 C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.InstallLog 위치에 있습니다.
어셈블리 'C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe'을(를) 설치하고 있습니다.
영향을 받는 매개 변수:
   logtoconsole =
   assemblypath = C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe
   logfile = C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.InstallLog
SocketShifterServerService 서비스를 설치하고 있습니다...
SocketShifterServerService 서비스가 설치되었습니다.
EventLog 소스 SocketShifterServerService을(를) 로그 Application에 만들고 있습니다...

Install 단계는 완료되었으며 Commit 단계를 시작하고 있습니다.
C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe 어셈블리의 진행 상황을 보려면 로그 파일 내용을 검토하십시오.
파일은 C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.InstallLog 위치에 있습니다.
어셈블리 'C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe'을(를) 커밋하고 있습니다.
영향을 받는 매개 변수:
   logtoconsole =
   assemblypath = C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.exe
   logfile = C:\test\socketshifter-27275\SocketShifterServer\bin\Debug\SocketShifterServer.InstallLog

Commit 단계가 완료되었습니다.

트랜잭트 설치가 완료되었습니다.

이제 서비스 관리자를 열어서 정상적으로 서비스로 등록되었는지 확인합니다.

[그림 4: Socket Shifter 서비스 등록 확인]
netservicebus_sample_4.png

서비스가 현재 "Local Service" 계정으로 되어 있는데, Windows Vista/2008에서는 접근 거부 오류가 발생할 것입니다. "Local System" 계정으로 바꿔주거나 혹은 적절하게 권한 설정을 해주시면 되겠습니다.

서비스가 정상적으로 시작된 것을 확인하고 나서, 다음 클라이언트 작업으로 넘어갑니다.




mstsc.exe를 실행해서 서버에 접근할 PC의 경우에는 설정이 다소 간단합니다. 역시 이 컴퓨터에도 .NET Services SDK를 설치하고,

Microsoft .NET Services SDK (July 2009 CTP)
; http://www.microsoft.com/downloads/details.aspx?FamilyID=38d8cf79-fc39-4aef-b3fd-ef280f2e9fa6&displaylang=en

이전에 codeplex에서 다운로드 받은 Socket Shifter 솔루션에서 "SocketShifterClient" 프로젝트의 app.config을 상황에 맞게 편집해 줍니다.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="solutionName" value="[솔루션 이름]"/>
    <add key="servicePath" value="[서버에서 구성한 servicePath 주소]"/>
    <add key="password" value="[솔루션 비밀번호]"/>
    <add key="localPort" value="1000"/>
    <add key="remoteHost" value="localhost"/>
    <add key="remotePort" value="3389"/>
  </appSettings>
</configuration>

이제 빌드하고, 응용 프로그램을 로컬에 실행시켜 둡니다.




사전 준비 작업은 위의 단계로 모두 완료되었습니다. 이제 mstsc.exe를 실행해서 실제로 원격 서버에 접속해 보는데요. 방법은, SocketShifterClient 응용 프로그램의 app.config에 등록한 localPort를 기준으로 주소를 다음과 같이 입력해 주면 됩니다.

[그림 5: mstsc 실행]
netservicebus_sample_5.png

그럼, mstsc.exe는 로컬에 실행된 SocketShifterClient.exe에 연결을 하고, SocketShifterClient.exe는 다시 app.config에 기록된 servicePath로 연결을 합니다. 그리곤 SocketShifterServer에게 remoteHost가 localhost이고, remotePort가 3389인 곳으로 접속을 시도하도록 합니다.

와~~~ 끝내주죠. ^^

이와 함께, ".NET Service Bus - Remote Desktop over Firewalls!" 글에서는 또 하나의 링크를 제공해 주고 있는데요.

.NET Services March 2009 CTP: Host a Public Website At The Kitchen Table or from a Coffee Shop! No Kidding.
; https://docs.microsoft.com/en-us/archive/blogs/clemensv/net-services-march-2009-ctp-host-a-public-website-at-the-kitchen-table-or-from-a-coffee-shop-no-kidding

이런 응용 사례로... 뭐 또 다른 좋은 아이디어가 있지 않을까요? ^^



[이 토픽에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 6/23/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 



2009-07-15 08시52분
Windows Azure Platform Pricing
; (broken) http://blogs.msdn.com/robinm/archive/2009/07/14/windows-azure-platform-pricing.aspx
kevin25
2022-02-11 10시52분
fatedier/frp
 - A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
; https://github.com/fatedier/frp/
정성태

... 16  17  18  19  20  [21]  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13119정성태8/18/20226754.NET Framework: 2044. .NET Core/5+ 프로젝트에서 참조 DLL이 보관된 공통 디렉터리를 지정하는 방법
13118정성태8/18/20225576.NET Framework: 2043. WPF Color의 기본 색 영역은 (sRGB가 아닌) scRGB [2]
13117정성태8/17/20227748.NET Framework: 2042. C# 11 - 파일 범위 내에서 유효한 타입 정의 (File-local types)파일 다운로드1
13116정성태8/4/20228211.NET Framework: 2041. C# - Socket.Close 시 Socket.Receive 메서드에서 예외가 발생하는 문제파일 다운로드1
13115정성태8/3/20228594.NET Framework: 2040. C# - ValueTask와 Task의 성능 비교 [1]파일 다운로드1
13114정성태8/2/20228777.NET Framework: 2039. C# - Task와 비교해 본 ValueTask 사용법파일 다운로드1
13113정성태7/31/20228050.NET Framework: 2038. C# 11 - Span 타입에 대한 패턴 매칭 (Pattern matching on ReadOnlySpan<char>)
13112정성태7/30/20228436.NET Framework: 2037. C# 11 - 목록 패턴(List patterns) [1]파일 다운로드1
13111정성태7/29/20228167.NET Framework: 2036. C# 11 - IntPtr/UIntPtr과 nint/nuint의 통합파일 다운로드1
13110정성태7/27/20228243.NET Framework: 2035. C# 11 - 새로운 연산자 ">>>" (Unsigned Right Shift)파일 다운로드1
13109정성태7/27/20229696VS.NET IDE: 177. 비주얼 스튜디오 2022를 이용한 (소스 코드가 없는) 닷넷 모듈 디버깅 - "외부 원본(External Sources)" [1]
13108정성태7/26/20227611Linux: 53. container에 실행 중인 Golang 프로세스를 디버깅하는 방법 [1]
13107정성태7/25/20226770Linux: 52. Debian/Ubuntu 계열의 docker container에서 자주 설치하게 되는 명령어
13106정성태7/24/20226524오류 유형: 819. 닷넷 6 프로젝트의 "Conditional compilation symbols" 기본값 오류
13105정성태7/23/20227814.NET Framework: 2034. .NET Core/5+ 환경에서 (프로젝트가 아닌) C# 코드 파일을 입력으로 컴파일하는 방법 - 두 번째 이야기 [1]
13104정성태7/23/202210890Linux: 51. WSL - init에서 systemd로 전환하는 방법
13103정성태7/22/20227400오류 유형: 818. WSL - systemd-genie와 관련한 2가지(systemd-remount-fs.service, multipathd.socket) 에러
13102정성태7/19/20226808.NET Framework: 2033. .NET Core/5+에서는 구할 수 없는 HttpRuntime.AppDomainAppId
13101정성태7/15/202215750도서: 시작하세요! C# 10 프로그래밍
13100정성태7/15/20228225.NET Framework: 2032. C# 11 - shift 연산자 재정의에 대한 제약 완화 (Relaxing Shift Operator)
13099정성태7/14/20228127.NET Framework: 2031. C# 11 - 사용자 정의 checked 연산자파일 다운로드1
13098정성태7/13/20226297개발 환경 구성: 647. Azure - scale-out 상태의 App Service에서 특정 인스턴스에 요청을 보내는 방법 [1]
13097정성태7/12/20225693오류 유형: 817. Golang - binary.Read: invalid type int32
13096정성태7/8/20228629.NET Framework: 2030. C# 11 - UTF-8 문자열 리터럴
13095정성태7/7/20226690Windows: 208. AD 도메인에 참여하지 않은 컴퓨터에서 Kerberos 인증을 사용하는 방법
13094정성태7/6/20226430오류 유형: 816. Golang - "short write" 오류 원인
... 16  17  18  19  20  [21]  22  23  24  25  26  27  28  29  30  ...