Development Platform
1. VisualStudio2008SP1
2. NETFramework3.5SP1
3. ASP. NET AJAX
4. IIS7 or VS integrated Web server [WCF and SVS file configuration]
5. Windows Vista
WCF (WindowsCommunicationFoundation) adds many features to enhance the Microsoft Application Development Platform, especially for communications between applications. In this article, we will learn how WCF is used directly in client JavaScript. This is a cool feature provided by ASP. net ajax. In this article, we will not discuss much about the internal details of WCF, but will focus on how to directly use services in JavaScript. Therefore, we will not discuss how to manage the features of these functions during ASP. NET or. NET runtime.
To demonstrate the theories and facts involved in this article, we will create a solution with two projects. Therefore, you do not need to waste time creating a blank solution and saving it. Now, add a new class library project to the solution. Name the class library ServiceLibrary. Then, add a Web application project to the solution and name it WEBUI. We will see two ways to add a WCF Service that can be called by JavaScript.
1. Use the AJAX-enabled WCF Service item Template
2. Use the service interface definition in the class library
Use the AJAX-enabled WCF Service item Template
Here, we will see a simple and clear way to call a WCF Service in JavaScript. Right-click the Web application project and choose add new project. Select the AJAX-enabled WCF Service item template, name it "HelloWorldService. svc", and click "OK. In this case, the wizard will add a HelloWorldService. svc file as expected to the solution. This file also provides the code separation page. If you open the file in an XML file editor, you will see the following labels:
- <%@ ServiceHost Language="C#" Debug="true"
- Service="WebUI.HelloWorldService" CodeBehind="HelloWorldService.svc.cs" %>
The above is a JavaScript call in ASP. net ajax.
- SQL statements in ASP. NET
- Use StringBuilder in ASP. NET
- Response. Write in ASP. NET
- Analysis on ASP. NET authorization Module
- Processing Process for ASP. NET Runtime