1
WCF 서비스를 처음 사용합니다. ASP.NET에서 WCF 서비스를 사용하여 jQuery를 통해 DropDownList
에 데이터를 바인딩하고 싶습니다.WCF 서비스를 사용하여 클라이언트 측을 통해 DropDownList에 데이터를 바인딩하는 방법
WCF 서비스를 처음 사용합니다. ASP.NET에서 WCF 서비스를 사용하여 jQuery를 통해 DropDownList
에 데이터를 바인딩하고 싶습니다.WCF 서비스를 사용하여 클라이언트 측을 통해 DropDownList에 데이터를 바인딩하는 방법
그것은 당신이 인터넷에서 예를 들어 많은
http://msdn.microsoft.com/en-us/netframework/dd547388
jQuery를
이 JSON 응답을 나머지 서비스 (귀국일 JSON)을 생성하고 소비 할 수있는 WCF에서 간단한$.ajax(..)
전화
http://api.jquery.com/jQuery.ajax/
입니다. C#에서
샘플 (아톰 피드) :
[ServiceContract]
public interface INewsFeed
{
[OperationContract]
[WebGet]
Atom10FeedFormatter GetFeeds();
}
public class NewsFeed : INewsFeed
{
public Atom10FeedFormatter GetFeeds()
{
SyndicationFeed feed = new SyndicationFeed("My Blog Feed", "This is a test feed", new Uri("http://SomeURI"));
feed.Authors.Add(new SyndicationPerson("[email protected]"));
feed.Categories.Add(new SyndicationCategory("How To Sample Code"));
feed.Description = new TextSyndicationContent("This is a how to sample that demonstrates how to expose a feed using RSS with WCF");
SyndicationItem item1 = new SyndicationItem(
"Lorem ipsum",
"Lorem ipsum",
new Uri("http://localhost/Content/One"),
"ItemOneID",
DateTime.Now);
List<SyndicationItem> items = new List<SyndicationItem>();
items.Add(item1);
feed.Items = items;
return new Atom10FeedFormatter(feed);
}
}
및 SVC에 당신은 (공장 부분)를 추가해야합니다 편집
<%@ ServiceHost Language="C#" Debug="true" Service="RssReader.Wcf.NewsFeed" CodeBehind="NewsFeed.svc.cs" Factory=System.ServiceModel.Activation.WebServiceHostFactory%>
:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
중요 부분은입니다. 그 시나리오에서은 어떤 종단점을 정의 할 필요가 없다.
감사의 말을 전합니다. 웹 구성 파일에 필요한 구성이 있는지 알고 싶습니까? – YogeshWaran
편집에 필요한 구성을했습니다. –
답장을 보내 주셔서 감사합니다. WCF의 간단한 예가 있습니다. 나는 단지 학습자이다. 쉬운 예제를 원합니다 ... – YogeshWaran