You cannot return a stream from a web method - not even a read-only stream, let alone a writeable stream.
You will need to read the file contents in the client and pass it in to the web method.
[WebMethod]
public void UploadFileToFtp(string firmName, string filePath, byte[] fileBytes)
{
string ftpAdress = ftpServer + ":" + ftpPort + "//" + ftpFolder + "/" + firmName + "/" + Path.GetFileName(filePath);
using (FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(ftpAdress))
{
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(ftpUser, ftpPass);
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = true;
using (var stream = request.GetRequestStream())
{
stream.Write(fileBytes);
}
}
}
byte[] fileBytes = File.ReadAllBytes(filePath);
Licence.LicenceServiceClient.UploadFileToFtp(AppSettings.firmCode, filePath, fileBytes);
status = "Dosya başarıyla " + ftpAdress + " adresine yüklendi!";