How to write WCF Services in Microsoft Visual Studio 2008
open visual studio 2008
1. Create New project
2. go to WCF tab
3. select WCF Service Library
4. Name the folder name called library: e.g. Calculator and then click ok.
5. Rename the Services name of project as you wish
6. general convention is just adding the word Service after library name e.g.: CalculatorService on .cs file and interface file ICalculatorService.cs
7. make some function like as: add
on CalculatorService.cs file
namespace CalcAreaWcf
{
public class CalcAreaWcfService : ICalcAreaWcfService
{
public double CalcAreaSquare(float fY)
{
double calcValue = fY * fY;
return calcValue;
}
}
}
on ICalcAreaWcfService.cs file
namespace CalcAreaWcf
{
[ServiceContract]
public interface ICalcAreaWcfService
{
[OperationContract]
double CalcAreaSquare(float fY);
}
}
8. add reference: System.ServiceModel
9. change the name of service on app.config as well. eg CalcAreaWcfService and ICalcAreaWcfService
10. build the service
i thing it should build, if u want to run the service then press Ctrl+F5 you can see the running service on localhost.
Cheers! then you are able to build WCF Service
Showing posts with label ASP.NET and Web Services. Show all posts
Showing posts with label ASP.NET and Web Services. Show all posts
Friday, May 15, 2009
Tuesday, May 5, 2009
ASP.NET and Web Services
* C# can be a main language to code in ASP.NET other VB.NET or C++ as well.
* Web service can be constructed with .ASMX extension and can be done with note pad, word pad or visual studion 2008.
* Visual studio will be easier.
* can be access the web service with SOAP or HTTP GET or HTTP POST.
* Web service will be written like as simple Object oriented programing in C#.
* we can write the functionality as contract to access from client. that contract will be called using SOAP or HTTP method to access.
* this contract is written in Standard lagnuage called WSDL. and Web services will be accesed through that WSDL of that particular services.
* Web service can be constructed with .ASMX extension and can be done with note pad, word pad or visual studion 2008.
* Visual studio will be easier.
* can be access the web service with SOAP or HTTP GET or HTTP POST.
* Web service will be written like as simple Object oriented programing in C#.
* we can write the functionality as contract to access from client. that contract will be called using SOAP or HTTP method to access.
* this contract is written in Standard lagnuage called WSDL. and Web services will be accesed through that WSDL of that particular services.
Labels:
ASP.NET and Web Services,
C#,
Create Service,
Internet
Subscribe to:
Posts (Atom)