用户名或密码不正确 | System.IO.IO异常

问题描述

当 API 托管在 IIS 上时,我收到文件只读错误。但是我可以从主机访问相同的路径,但在托管时失败。请指教。

代码

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,length);
//Byte[] bytes = File.ReadAllBytes(ss);
                
String file = Convert.ToBase64String(buffer);
return Ok(file);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)