Search code examples
c#debuggingwsdlexewebservice-client

ServiceClient Null-Exeption in deployed Program while running in Debug


I have a program, which creates a webservice client flawless in debug mode (Visual Studio 2019 updated). In the debugging everything works just fine. When deploy it as exe on another PC, suddenly I get a null-Exception at the point where the webservice client is created.

public static BookingWebServiceClient GetbookingWebServiceClient() 
    {
        try
        {
            Program.mlogger.logger.Info("Try create SERVICE CLIENT");
            BookingWebServiceClient serviceClient = null;
            Program.mlogger.logger.Info("Try create new SERVICE CLIENT");
            serviceClient = new BookingWebServiceClient();
            return serviceClient;
        }

        catch (Exception Clientex)
        {
            Program.mlogger.logger.Info("Check 1 Error: " + Clientex.Message);
            Program.mlogger.logger.Info("Check 2 Error: " + Clientex.InnerException.Message);
            Program.mlogger.logger.Info("Check 3 Error: " + Clientex.InnerException.Source);
            return null;
        } 
    }

In debug the client is created without problems, if I start the exe locally it comes to the error

Try create SERVICE CLIENT

Try create new SERVICE CLIENT

System.NullReferenceException: The object reference was not made to an object instance

There is no DLL or something needed, also the configs seems good to me

<bindings>
    <basicHttpBinding>
           <binding name="BookingWebServiceServiceSOAPBinding1" />
                <binding name="BookingWebServiceServiceSOAPBinding2">
                    <security mode="Transport" />
                </binding>
                <binding name="BookingWebServiceServiceSOAPBinding3" />
      </basicHttpBinding>
</bindings>

Solution

  • The answer was that the customer's server environment had no internet connection (it was ridiculous).