0
我正在開發一個使用VS 2012的Asp.Net MVC 4應用程序。本地使用IIS Express作爲Web服務器。我在嘗試訪問作爲我的解決方案一部分的文件時遇到問題。我有以下操作方法:VS 2012&IIS Express。找不到路徑的一部分'C: Program Files(x86) IIS Express 〜 MyPics My.jpg'
public FileContentResult GetImage()
{
byte[] imageByte = System.IO.File.ReadAllBytes(@"/MyPics/My.jpg");
string contentType = "image/jpeg";
return File(imageByte, contentType);
}
在第一行,我收到以下錯誤:
Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\MyPics\My.jpg'
我知道,上面的路徑是不正確的,但我無法理解什麼路徑我應該提供以解決這個問題。
問候 爬完米什拉
非常感謝。有用。 – 2013-04-07 15:54:15
太棒了,到處尋找這個。日Thnx! – texian 2013-09-10 20:35:42