The user name or password is incorrect | System.IO.IOException

2.3k Views Asked by At

I am getting an error on file read only when the API is hosted on IIS. But I am able to access the same path from the host but it fails when hosted. Please advise.

Code:

var stream = new FileStream(param, FileMode.Open, FileAccess.Read, FileShare.Read);
Int32 length = stream.Length > Int32.MaxValue ? Int32.MaxValue : Convert.ToInt32(stream.Length);
Byte[] buffer = new Byte[length];
stream.Read(buffer, 0, length);
//Byte[] bytes = File.ReadAllBytes(ss);
                
String file = Convert.ToBase64String(buffer);
return Ok(file);
0

There are 0 best solutions below