-
Open Visual Studio 2005 as an administrator by right-clicking the program in the StartRun as administrator. menu and selecting
-
Create a new console application project. In the New Project dialog, select Visual BasicVisual C#, and choose the Console Application template, and name it Service. Use the default Location. or
-
Change the default
Service
namespace toMicrosoft.ServiceModel.Samples
. -
Provide a reference to the System.ServiceModel namespace for the project: Right-click the Service project in the Solution Explorer, select The System.ServiceModelComponent Name from the .NET tab, and click OK.
using System;
// Step 5: Add the using statement for the Sytem.ServiceModel namespace
using System.ServiceModel;
namespace Microsoft.ServiceModel.Samples
{
// Step 6: Define a service contract.
[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
public interface ICalculator
{
// Step7: Create the method declaration for the contract.
[OperationContract]
double Add(double n1, double n2);
[OperationContract]
double Subtract(double n1, double n2);
[OperationContract]
double Multiply(double n1, double n2);
[OperationContract]
double Divide(double n1, double n2);
}
}
No comments:
Post a Comment