Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 46. .NET Service Bus 응용 사례: SocketShifter [링크 복사], [링크+제목 복사],
조회: 26956
글쓴 사람
정성태 (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/
정성태

... 76  77  78  79  [80]  81  82  83  84  85  86  87  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
11936정성태6/10/201918379Math: 58. C# - 최소 자승법의 1차, 2차 수렴 그래프 변화 확인 [2]파일 다운로드1
11935정성태6/9/201919944.NET Framework: 843. C# - PLplot 출력을 파일이 아닌 Window 화면으로 변경
11934정성태6/7/201921284VC++: 133. typedef struct와 타입 전방 선언으로 인한 C2371 오류파일 다운로드1
11933정성태6/7/201919611VC++: 132. enum 정의를 C++11의 enum class로 바꿀 때 유의할 사항파일 다운로드1
11932정성태6/7/201918790오류 유형: 544. C++ - fatal error C1017: invalid integer constant expression파일 다운로드1
11931정성태6/6/201919306개발 환경 구성: 441. C# - CairoSharp/GtkSharp 사용을 위한 프로젝트 구성 방법
11930정성태6/5/201919841.NET Framework: 842. .NET Reflection을 대체할 System.Reflection.Metadata 소개 [1]
11929정성태6/5/201919410.NET Framework: 841. Windows Forms/C# - 클립보드에 RTF 텍스트를 복사 및 확인하는 방법 [1]
11928정성태6/5/201918174오류 유형: 543. PowerShell 확장 설치 시 "Catalog file '[...].cat' is not found in the contents of the module" 오류 발생
11927정성태6/5/201919410스크립트: 15. PowerShell ISE의 스크립트를 복사 후 PPT/Word에 붙여 넣으면 한글이 깨지는 문제 [1]
11926정성태6/4/201919936오류 유형: 542. Visual Studio - pointer to incomplete class type is not allowed
11925정성태6/4/201919783VC++: 131. Visual C++ - uuid 확장 속성과 __uuidof 확장 연산자파일 다운로드1
11924정성태5/30/201921421Math: 57. C# - 해석학적 방법을 이용한 최소 자승법 [1]파일 다운로드1
11923정성태5/30/201921048Math: 56. C# - 그래프 그리기로 알아보는 경사 하강법의 최소/최댓값 구하기파일 다운로드1
11922정성태5/29/201918538.NET Framework: 840. ML.NET 데이터 정규화파일 다운로드1
11921정성태5/28/201924397Math: 55. C# - 다항식을 위한 최소 자승법(Least Squares Method)파일 다운로드1
11920정성태5/28/201916053.NET Framework: 839. C# - PLplot 색상 제어
11919정성태5/27/201920312Math: 54. C# - 최소 자승법의 1차 함수에 대한 매개변수를 단순 for 문으로 구하는 방법 [1]파일 다운로드1
11918정성태5/25/201921151Math: 53. C# - 행렬식을 이용한 최소 자승법(LSM: Least Square Method)파일 다운로드1
11917정성태5/24/201922140Math: 52. MathNet을 이용한 간단한 통계 정보 처리 - 분산/표준편차파일 다운로드1
11916정성태5/24/201919952Math: 51. MathNET + OxyPlot을 이용한 간단한 통계 정보 처리 - Histogram파일 다운로드1
11915정성태5/24/201923067Linux: 11. 리눅스의 환경 변수 관련 함수 정리 - putenv, setenv, unsetenv
11914정성태5/24/201922064Linux: 10. 윈도우의 GetTickCount와 리눅스의 clock_gettime파일 다운로드1
11913정성태5/23/201918764.NET Framework: 838. C# - 숫자형 타입의 bit(2진) 문자열, 16진수 문자열 구하는 방법파일 다운로드1
11912정성태5/23/201918726VS.NET IDE: 137. Visual Studio 2019 버전 16.1부터 리눅스 C/C++ 프로젝트에 추가된 WSL 지원
11911정성태5/23/201917495VS.NET IDE: 136. Visual Studio 2019 - 리눅스 C/C++ 프로젝트에 인텔리센스가 동작하지 않는 경우
... 76  77  78  79  [80]  81  82  83  84  85  86  87  88  89  90  ...