0

I am trying to call an existing WCF service. I have generated (and updated many times) the service reference. This service has two methods. One method returns a string and the other returns a large POCO. When I call the string method using my local IIS (not IIS Express) with an app pool setup for the service account that I intend to use in DEV, I get a valid response. When I call the other method I receive this error.

An exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll but was not handled in user code Additional information: Could not find a part of the path 'C:\Windows\TEMP\1c4e1c24-69a4-4cdd-bca8-73f6b2415d48'.

When I call that same method using the WCFTestClient.exe with the same input parameter I receive a successful reply.

My temp directory has modify access for the Everyone group.

This is the code that I'm using to call the service.

public class BackupRetrievalServiceClient : ClientBase<IBackupRetrievalService>, IBackupRetrievalService
{
    public BackupRetrievalServiceClient()
    {
    }

    public BackupRetrievalServiceClient(string endpointConfigurationName) :
        base(endpointConfigurationName)
    {
    }

    public BackupRetrievalServiceClient(string endpointConfigurationName, string remoteAddress) :
        base(endpointConfigurationName, remoteAddress)
    {
    }

    public BackupRetrievalServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) :
        base(endpointConfigurationName, remoteAddress)
    {
    }

    public BackupRetrievalServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress remoteAddress) :
        base(binding, remoteAddress)
    {
    }

    public ProformaDataContract GetClientProformaData(string socialSecurityNumber)
    {
        return Execute(client => client.GetClientProformaData(socialSecurityNumber));
    }

    public string GetVersion()
    {
        return Execute(client => client.GetVersion());
    }

    #region Execute

    private static TResult Execute<TResult>(Func<IBackupRetrievalService, TResult> function)
    {
        TResult result;
        BackupRetrievalService.BackupRetrievalServiceClient client = new BackupRetrievalService.BackupRetrievalServiceClient();

        try
        {
            result = function(client);
        }
        finally
        {
            try
            {
                if (client.State != CommunicationState.Faulted)
                {
                    client.Close();
                }
            }
            catch
            {
                client.Abort();
            }
        }

        return result;
    }

    #endregion
}

The error is thrown on the single line in the GetClientProformaData method.

SQL Hammer
  • 276
  • 5
  • 16

1 Answers1

0

I was under the impression that this error was on my side, not the service side, because of the WCF Test. Apparently, my input was being passed in incorrectly so my WCF Test was not a valid test. In addition, this error was being passed back to me from the service and related to its use of the temp directory but only threw and exception when certain types of inputs were passed in.

Solution: I fixed my code to pass in the parameter correctly and communicated with the other team for them to either improve parameter validation, throw better error messages, and/or fix the bug that causes the temp folder clean-up to fail under abnormal conditions.

Thank you to everyone who responded or even took a few seconds to think about my problem.

SQL Hammer
  • 276
  • 5
  • 16