LOGINSERVICE.LoginWebServiceSoapClient not init and cause System.ServiceModel.CommunicationObjectFaultedException

I am a newbie to ASP MVC. When I using the LOGINSERVICE.LoginWebServiceSoapClient to check the user info, I meet a problem about the class construct error. The error message shows “System.ServiceModel.CommunicationObjectFaultedException”, and the state of LoginWebServiceSoapClient is Faulted.

the following is my code Snippet:

public ActionResult Logon(LoginInfo data)
    LOGINSERVICE.LoginWebServiceSoapClient client = new LOGINSERVICE.LoginWebServiceSoapClient();
    client.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 5);

And the setting of the web.config is as belowed:

    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
    <authentication mode="Forms">
      <forms name=".ExampleWeb" loginUrl="~/Account/Login/" timeout="120" />
        <binding name="LoginWebServiceSoap">
          <security mode="Transport" />
        <binding name="LoginWebServiceSoap1" />
        <binding name="LoginWebServiceSoap2">
          <security mode="Transport" />
        <binding name="LoginWebServiceSoap3" />
      <endpoint address="https:XXXXXXXXXXX.asmx"
        binding="basicHttpBinding" bindingConfiguration="LoginWebServiceSoap2"
        contract="LOGINSERVICE.LoginWebServiceSoap" name="LoginWebServiceSoap1" />

Is there any instruction for this, and how to fix that,and why it happening in this way? Any instruction is highly appreciated, thanks.


After some discussions, the situation is solved via delete and rebuild Web Service, and furthermore, not setting breakpoint on the code:

  LOGINSERVICE.LoginWebServiceSoapClient client = new LOGINSERVICE.LoginWebServiceSoapClient();

My environment is Visul Studio 2019, and if the run into debug mode and stop on the breakpoint on the upper code snippet, the connection state wii be Faulted. That’s all I got. Any suggestion is appreciated, thanks.