Error calling a service through ServiceClient in C #

0

I have a project part (MVC that connects to DB through web services) from my company that calls WCF services like this:

public static ReturnType CallWebMethod<TService, ReturnType>(String endpointConfigurationName, String myMethod, object[] parameters = null)
    where TService : class
    {
        var client = new ServiceClient<TService>(endpointConfigurationName);

        // Get a type from the class 
        Type type = client.Proxy.GetType();

        // Retrieve the method you are looking for
        MethodInfo methodInfo = type.GetMethod(myMethod);

        ReturnType result;
        bool success = false;
        try
        {
            // Invoke the method on the instance we created above
            result = (ReturnType)methodInfo.Invoke(client.Proxy, parameters);
            if (client.State != CommunicationState.Faulted)
            {
                client.Close();
                success = true;
            }
        }
        finally
        {
            if (!success)
                client.Abort();
        }

        return result;
    }

I downloaded the project from the repository (the project in the repository is the final version that is in production) and I have received the error Object Reference not set to an instance of an object because of methodInfo , which is null. Supposedly I give the name of the service and the name of the method, both valid (they work in production), but it can not find them.

I make the call like this:

return ServicesHelper.CallWebMethod<BusinessServicesImplementation.IBusinessOportunitiesService, bool>
             ("BusinessServicesImplementation.BusinessOportunitiesService", "SyncUpGpc_Aiccopn_Users_and_Companies", par);

What can I do to try to identify the problem?

    
asked by anonymous 12.09.2017 / 15:20

0 answers