G
G
gsv20152018-05-07 11:12:25
IIS
gsv2015, 2018-05-07 11:12:25

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;
    }
   }
 }

File Service1.svc.cs
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();
    }
  }
 }

The lab assistant said to change the service like this, the C# implementation code was made in the .config file, please help.............

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question