I have a shared folder (assets) in the Ubuntu machine and ASP.NET MVC application in a Windows machine. Both machines are in the same network and I have to save files in the shared folder in Ubuntu from the MVC application. When I run the application in IISExpress , the application saves the files without any error. But when I host the application in IIS , it gives me an error.
The specified server cannot perform the requested operation.
Here is the code I am using to save the files.
try
{
string sourceFile = @"D:\myfile.pdf";
string destinationPath = @"\\ubuntu\assets/";
byte[] fileBytes = System.IO.File.ReadAllBytes(sourceFile);
System.IO.File.WriteAllBytes(destinationPath + Guid.NewGuid().ToString() + ".pdf", fileBytes);
}
catch (Exception ex)
{
}
I played with Identity in Application Pool in IIS to LocalSystem, NetworkService. Any thoughts on how to achieve this goal?
One way I achieve this is as below:
I don't know if it is the right way to doing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.