본문 바로가기

C#

[WCF] WCF의 기초 통신



기본적인 통신으로서 Http 를 이용하겠다.


서버측 인터페이스 (DLL 으로 뽑을것)
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace StikusFrameServiceInterFace
{
    [ServiceContract]
    public interface ISFServerProtocol
    {
        [OperationContract]
        string StikusFrameAuth(string AuthXmlDataString);


        [OperationContract]
        string StikusFrameClose(string AuthXmlDataString);
        
    }
}


서버측 구현

using System; using System.Collections.Generic; using System.Linq; using System.Text; using StikusFrameServiceCore.JUtil.Trace; using StikusFrameServiceInterFace; using System.ServiceModel; namespace StikusFrameServiceCore { public class StikusFrameServiceStart { ServiceHost SFService; public StikusFrameServiceStart() { JTrace.trace("start!"); SFService = new ServiceHost( typeof(SFServiceProtocol), //ISFServerProtocol 를 구현한 클래스 new Uri("http://wow/wowblahblah"));

SFService.AddServiceEndpoint( typeof(ISFServerProtocol) , new BasicHttpBinding() , ""); SFService.Open(); } public void CloseSFService() { SFService.Close(); } } }




클라이언트 ( 위의 인터페이스를 .DLL 으로 공유 한다. )

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ServiceModel;
using System.ServiceModel.Description;
using StikusFrameServiceInterFace;
namespace WCFClient
{
    /// <summary>
    /// MainWindow.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            Uri uri = new Uri("http://wow/wowblahblah");
            ServiceEndpoint ep = new ServiceEndpoint(
                ContractDescription.GetContract(typeof(ISFServerProtocol)) ,
                new BasicHttpBinding() ,
                new EndpointAddress(uri));

            ChannelFactory<ISFServerProtocol> factory =
                new ChannelFactory<ISFServerProtocol>(ep);

            ISFServerProtocol proxy = factory.CreateChannel();
            string result = proxy.StikusFrameAuth("auth");
            Console.WriteLine(result);
        }
    }
}




클라이언트 배포시 보안상의 이유호 서버측의 인터페이스만 DLL 로 공유하는 방법을 선택한다.

태그

  • 이전 댓글 더보기
  • BlogIcon mont blanc pen 2015.02.02 02:01

    지수Juicy Juice for Brain Development

    The other day I blogged about the FDA's nabbing General Mills for inappropriately printing specific health claims (the kind reserved for drugs) on Cheerios boxes. I'm not the only observer who felt that, while the FDA was certainly within its rights to call out the cereal maker for not playing by the rules, the food safety agency must surely have bigger fish to선이

  • BlogIcon furla purses 2015.02.04 13:34

    할드Laces and ribbons generating riddled together with Irish customized

    The particular Irish customized related to laces and ribbons generating staggers the particular creativeness. It provides crocheted laces and ribbons together with picots in addition to bloom kinds, Youghal connect laces and ribbons while using design defined inside couching sewing making use of great collection, Inishmacsaint 비야

  • BlogIcon mont blanc outlet 2015.02.18 23:10

    는에Display your own Vacation Nature along with Xmas Fingernails

    Xmas Fingernails, That you can do your self! Prepared for many Vacation Nature, compared to it is time for you to convey your self along with a few Xmas Fingernails. The holiday season really are a period associated with pleasure as well as perk not to mention ENJOYABLE!

    Therefore let us get a fingernails in to which christmas natu방가

  • BlogIcon fulinglasses review 2015.03.05 17:04

    시지1 of 4
    by Nick Somoski

    Created on: could04, 2012 Last Updated: could12, 2012

    employingoil in cooking and meal preparations is a populartechnique, and olive oil is an ingredient that
    2 of 4
    by Trenna Sue Hiler

    Created on: could04, 2012

    Oli리메

  • BlogIcon burberry trench sale 2015.03.07 16:31

    법마Real Expensive Air Jordan Shoes v Real Inexpensive Air Jordan Shoes,louis vuitton neverfull

    Real or fake, Air Jordan shoes are one of the more expensive shoes available, basketball shoes at least. But that doesn t stop people doing everything that they can to get a pair. This is a generalized statement of course,tory burch outlet, not everyone has to have basketball shoes,gucci sneakers for men예지

  • BlogIcon furla handbags 2015.03.18 21:58

    버분How you can Connect the Flemish Flex,oakley sunglasses

    Right now the Flemish Flex is really a flex. The flex varies from the knot simply because it's a method of tying 2 rules collectively in a manner that you are able to untie all of them. Right now having a Flemish Flex aged seamen truly did not enjoy it really an excessive amount of simply because back again several years ago it had been mai지비

  • 단분URL aIci,bikini burberry pas cher相关的主题文章:리로

  • BlogIcon t shirt burberry pas cher 2015.03.27 21:10

    마로Xishan seulement C &agrave; partir de la personne n'ose pas lentement vers l'avant apr&egrave;s la rencontre de passagers ce 徐公三 assassiner l'ennemi des comportements individuels alors "mal" qui s'est exprim&eacute;Pas echarpe burberry soldes sans un cerveau le plomb dans la guerre Sun ce que l'adversaireSun Quan mon fr&egrave;re est un caract&egrave;re insidieux l'histoire a dit qu'il &eacute;tai비부

  • BlogIcon louis vuitton belts for men 2015.03.29 14:59

    어없How to choose the perfect graphics card for your needs

    Computer gaming has been growing in popularity since its inception exactly 40 years ago this year. Even though the early games were incredibly primitive, today's games need the highest of computer power as game inventors push computer skills to the limit by creating the greatest looking games ever created. Every computer gamer will know the히는

  • BlogIcon burberry trench coat 2015.03.29 17:42

    비던Work unveils forestry bundle

    "Federal Work facilitates the actual Tasmanian Neighborhood Woodland Contract (TCFA) that supplied for that extra safety associated with more than 170, 000 hectares associated with woodland,gucci oulet, such as forty five,gucci factory store, 000 hectares associated with woodland upon personal property with the Woodland Preservation Account, inch he or she stated.
    는지

  • BlogIcon basket burberry homme 2015.03.31 00:03

    뉴마URL aIci,sacs burberry,basket burberry pas cher相关的主题文章:


    相关的主题文章:뉴서

  • 匿名 2015.03.31 08:50

    련이The passwords you select for your computer should be different from the passwords you select for online shopping. When selecting a password for your financial institutions use a creative password. Choose a string of at least five letters, numbers, and punctuation marks.



    Tip Two - Legitimacy



    Tip Three - Encryption



    Ironic how the absence of life (which is visual, with them being습이

  • 匿名 2015.04.01 06:28

    전크In fact, AIRMAX and not stand still, today we join in the use of special powers of the Nike Air Max 2009 sale,Social Networking for Your Coffee Shop, Part 1_58653., AIRMAX identification of a new era to create. Nike Air Max 2009 sale, the use of a feature of the technology of today's most ardent Flywire.



    Although the use of new technologies and maintaining AIRMAX traditional shoe design lin분수

  • 匿名 2015.04.03 13:49

    수리,Retail Shopping Centers - Gro

    火车采集器html简单模板示范






    What Are Motorcycle Helmets Made Of?







    [标签:来源]








    For many years, motorcycle helmets were made primarily of two types of material: mold injected hard plastic, and fiberglass. However, helmet technology has advanced just like technology in everything else. You can now find helmets made of more exotic materia드있

  • 匿名 2015.04.03 17:37

    시법Art of Beauty - The Wall Stickers!







    [标签:来源]








    These are the days of artful and professional marketing. Everybody wants to earn ample profit with minimum cost. Therefore, cheap wall sticker printing has emerged as the best marketing tool to promote your products and services worldwide in a cost-effective manner. Mostly, they are stuck on the walls in order to attract th전표

  • BlogIcon oakley outlet 2015.04.03 22:10

    하서The ruling was a victory for Brown and his four wives and other fundamentalist Mormons who discount oakley sunglasses believe polygamy brings exaltation in heaven

    FILE In this undated file photo provided by TLC, Kody Brown, center, poses with his wives, furla handbags from left, Janelle, Christine, Meri, and Robyn in a tory burch outlet stores promotional photo for TLC reality TV show, "Siste어히

  • 匿名 2015.04.04 02:54

    상메火车采集器html简单模板示范






    Experience Nature With Nature Walks







    [标签:来源]








    One of the most wonderful things you can do, that will enjoin all your human senses is to take a walk in nature, but before you do, it makes sense to learn a little bit about it,7 Reasons Online Shopping Mal, so that your critical eye can catch the essence of all you see, hear and smell. One ca련그

  • BlogIcon furla bags 2015.04.13 04:16

    알메Searching for the real adore

    You will find a number of things in the event you investigation hard adequate. Nevertheless together with specific factors, the particular harder an individual seem, the particular harder it is to find. The way the stage concerning enjoy it finds out an individual. Lots of people setup their very own beacons through dance clubs, others produce sensitive indications 로일

  • BlogIcon mont blanc pen 2015.04.13 06:59

    니관Uncomfortable types invading Delaware H2o Room

    Initial contained in the surface of the Delaware 5 years ago, Silldorff recently observed large blossoms in the uncomfortable types inside the Delaware H2o Room Countrywide Play ground.

    "It's an undesirable foods provide regarding anything inside the louis vuitton site officiel drinking water. It's a poor algae to take, in . she or he mentioned.크있

  • BlogIcon oakley sunglasses 2015.04.14 01:53

    히어My personal tote odours horrible

    Fill up this along with comfortable, not really warm, drinking water as well as meal cleaning soap. Swish as well as get rid of. Do that once again, gently cleaning the location in which the chowder had been. Replicate till no smelly.

    submitted through Night_owl from 9: twenty six 'M upon Feb twenty six, 2011 [1 favorite]

    Are you able to transform it withi메뉴