我會從客戶端上傳文件上傳控制圖像並將其轉換成流對象並將其發送到WCF服務拒絕的路徑,這個過程用asp.net應用程序工作,但當我在IIS 5.1承載此應用程序,同時上傳它顯示錯誤的文檔訪問上傳文件時
訪問路徑「C:\ Documents和Settings \ patnayak \桌面\ Temp.xlsx」被拒絕
Google搜索之後,我授予訪問我的系統中的Temp.xlsx的asp.net用戶權限,然後它正在工作。其他系統上傳文件如何?
我的代碼:
ClientBOL.CD.CPI2Library objLib = new ClientBOL.CD.CPI2Library();
UDO.CPI2LibraryList libfiles = new UDO.CPI2LibraryList(true, "");
HttpFileCollection hfc = Request.Files;
libfiles.CPI2Libraries = new UDO.CPI2Library[hfc.Count];
for (int i = 0; i < hfc.Count; i++)
{
HttpPostedFile hpf = hfc[i];
if (hpf.ContentLength > 0)
{
libfiles.CPI2Libraries[i] = new UDO.CPI2Library();
libfiles.CPI2Libraries[i].FileName = System.IO.Path.GetFileName(hpf.FileName);
libfiles.CPI2Libraries[i].FiletypeId = GetFileTypeId(System.IO.Path.GetFileName(hpf.FileName));
libfiles.CPI2Libraries[i].DoctypeId = 1;
FileInfo fileInfo = new FileInfo(hpf.FileName);
UDO.UDOFileOperations.RemoteFileInfo ri = new UDO.UDOFileOperations.RemoteFileInfo();
System.IO.FileStream stream = new System.IO.FileStream(hpf.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
ri.FileName = System.IO.Path.GetFileName(hpf.FileName);
ri.Length = fileInfo.Length;
ri.FileByteStream = stream;
ClientBOL.CD.FileOperations cdc = new ClientBOL.CD.FileOperations();
cdc.UploadFile(ri);
}
}
請讓我知道怎麼哪些權限必須給在IIS 5.1 – Sridhar