wcf2009. 5. 21. 16:36
환경
vs 2008

1. WCF Service Library로 프로젝트를 만든다.
2. Service1.cs and Service1.cs files 파일을 지우고 app.config를 이렇게 설정한다.
 1: <?xml version="1.0" encoding="utf-8" ?>
   2: <configuration>
   3:   <system.web>
   4:     <compilation debug="true" />
   5:   </system.web>
   6:   <system.serviceModel>
   7:     <services>
   8:     </services>
   9:     <behaviors>
  10:       <serviceBehaviors>
  11:       </serviceBehaviors>
  12:     </behaviors>
  13:   </system.serviceModel>
  14: </configuration>

3. add-new item 해서 WCF Service를 등록한다.

4.   IHelloWorld.cs에 이렇게 쓴다.
 1: [ServiceContract]
   2: public interface IHelloWorld
   3: {
   4:     [OperationContract]
   5:     string SayHello(string inputName);
   6: }

5. HelloWorld.cs class에는
 1: public class HelloWorld : IHelloWorld
   2: {
   3:     #region IHelloWorld Members
   4:     public string SayHello(string inputName)
   5:     {
   6:         return "Hello " + inputName;
   7:     }
   8:     #endregion
   9: }


실행하면 서비스가 시작된다.

소스 : [#FILE|WcfServiceLibrary1.zip|pds/200905/21/37/|mid|0|0|pds10|0#]


한글 잘설명해 놓은곳  : http://myiris12.textcube.com/tag/WCF
Posted by 동동(이재동)