Answer the question
In order to leave comments, you need to log in
A simple WCF service and how to configure its .config file?
Dear colleagues, good day! There is a simple WCF service, below I give the code of its files:
File IService1.cs
using System;
using System.ServiceModel;
namespace EssentialWCF
{
[ServiceContract]
public interface IService1
{
[OperationContract]
double GetPrice(string ticker);
}
public class Service1 : IService1
{
public double GetPrice(string ticker)
{
return Int32.Parse(ticker) + 94.85;
}
}
}
using System;
using System.ServiceModel;
namespace EssentialWCF
{
public class Service
{
public static void Main()
{
ServiceHost serviceHost = new ServiceHost(
typeof(Service1),
new Uri("http://localhost/EssentialWCF"));
serviceHost.AddServiceEndpoint(
typeof(IService1),
new BasicHttpBinding(), "");
serviceHost.Open();
Console.WriteLine("Для завершения нажмите <ENTER>.\n\n");
Console.ReadLine();
serviceHost.Close();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question