简体   繁体   中英

Debug WCF service in Console Application

I created a service WCF with Visual Studio 2017 and a console application to test it.

在此处输入图片说明

ConsoleAppTestWCF has a service Reference to TestWCF. There is the main method in Programm.cs :

static void Main(string[] args)
{
    ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
    Console.WriteLine("Give a value");

    String input = Console.ReadLine();
    int value;

    if (int.TryParse(input, out value))
    {
        Console.WriteLine(client.GetData(value));
    }

    client.Close();
}

My question is : How can I do to debug (with breakpoints, etc) the web service (in this case GetData method) ?

Thanks to CamiloTerevinto, there is the answer :

在此处输入图片说明

Right-click on solution. Select "Set StartUp Projects.."

在此处输入图片说明

Set both projects as startup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM