Hi Techs,
I have a job (upload files using c# code) which is running properly for SharePoint sites in different ports, but currently we facing problem with SharePoint site created using host header method (two SharePoint sites in port 80), all the settings are done properly and site is working fine , only when i access through c# code i am getting this error,
The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
my Code :
public static void UploadFileToLibrary(ClientContext clientContext, string fileName)
{
using (System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open))
{
Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext,string.Format("{0}//{1}", list.RootFolder.ServerRelativeUrl, System.IO.Path.GetFileName(fileName)),
fs, true);
Console.WriteLine("File Uploaded");
Console.ReadLine();
}
}
Thanks
Shiv Tech