[펌][WCF] Ajax 를 이용한 WCF 호출을 위한 설정.

seung-jae hwang·2019년 3월 21일
0

WCF

목록 보기
1/1

출처: https://lockdown.tistory.com/154 [나의 삶은 하은이를 중심으로~]

  • Web.Config
    <system.serviceModel>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/><!-- asp.net 상호작용을 위한 설정 -->
    
    <behaviors>      
    
      <serviceBehaviors>
    
        <behavior name="StatisticsServiceBehavior">            
    
          <serviceMetadata httpGetEnabled="true" />
    
          <serviceDebug includeExceptionDetailInFaults="true" />          
    
        </behavior>        
    
      </serviceBehaviors>
    
      <endpointBehaviors><!-- 스크립트를 통한 동작 허용 설정 -->
    
        <behavior name="StatisticsServiceAjaxBehavior"><
    
          <enableWebScript/>
    
        </behavior>
    
      </endpointBehaviors>
    
    </behaviors>
    
    <services>
    
      <service name="Infotops.LMS.WebSite.AdminSite.Services.StatisticsService" 
    
               behaviorConfiguration="StatisticsServiceBehavior">
    
        <endpoint behaviorConfiguration="StatisticsServiceAjaxBehavior" 
    
                  address="" 
    
                  binding="webHttpBinding" 
    
                  contract="Infotops.LMS.WebSite.AdminSite.Services.IStatisticsService">
    
        </endpoint><!-- 종점 바인딩 설정 -->
    
      </service>
    
    </services>

    </system.serviceModel>

  • SVC
    [ServiceContract(Namespace="http://www.ilat.kr/")]

public interface IStatisticsService {
[OperationContract]

    [WebInvoke(BodyStyle=WebMessageBodyStyle.WrappedRequest,Method="POST")]

    string GetStudyResultReportList(string companyId, string studyStartDate);

}

[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]

public class StatisticsService : IStatisticsService {

    public string GetStudyResultReportList(string companyId, string studyStartDate)

    {
           return string.Empty;
    }

}

출처: https://lockdown.tistory.com/154 [나의 삶은 하은이를 중심으로~]

0개의 댓글