I am using this code to read a file using web services,
FileStream stream = File.OpenRead(FileName);
byte[] contents = new byte[stream.Length];
stream.Read(contents, 0, (int)stream.Length);
stream.Close();
but I get this error
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Cannot open file "fileName.pdf". ---> Cannot open file "filename.pdf". at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at
Its random as well, sometimes it through error sometimes it doesn't.
Code is being used by 200+ users and it only throws exception randomly.
filename.pdfdoes not exist? Or at least not in the directory that the service is looking in? Try to include the entire path to the file. - D StanleyFile.Exists(path)? - Butzke