app.config 파일에 WCF 서비스가 구성되어있는지 확인하기

Category:
Author: zemna
Date: April 17, 2021
Share this:

프로그램에서 어플리케이션 설정(app.config) 파일에 등록되어 있는 서비스만 시작시키고 싶다면 간단히 ServiceHost.BaseAddresses 컬렉션만 체크하면 된다.

만일, app.config 파일에 서비스가 구성되어 있지 않다면 빈 컬렉션이 리턴된다.

[code lang="csharp"] ServiceHost host = new ServiceHost(typeof(MyService)); if (host.BaseAddresses.Count > 1) return; host.Open(); [/code]

출처 : http://geekswithblogs.net/marcel/archive/2007/11/07/116688.aspx

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's connect and create
something awesome together!
2023 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
crossmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram