0

I have a project using net core 3.1, I add reference service success but i not using it.

it alert error: Service_SoapClient does not contain a contrustor that take 0 arguments when I want using it.

my code

 public class Program
{
    public static void Main(string[] args)
    {
        **Service_SoapClient a = new Service_SoapClient();**

        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            });
}

please help me

how to resolt problem

kai
  • 15
  • 2
  • 1
    Does this answer your question? [Class does not contain a constructor that takes 0 arguments](https://stackoverflow.com/questions/22321272/class-does-not-contain-a-constructor-that-takes-0-arguments) – shingo Feb 20 '23 at 09:20

1 Answers1

0

The object simply can't be created with no arguments (there are three other possibilities regarding to the info text provided -> +3 overloads).

You can hover "Service_Client() and press Ctrl + left click to be redirected into the class definition to sift what arguments are possible to create that new object.

Is that what you already did? There is the partial flag next to the class name, so possible that there is another constructor in another partial class file available.

kai
  • 15
  • 2
drfraenk
  • 1
  • 2