我正在尝试使用Web方法读取文件
[WebMethod]
public string getjson()
{
string contents = File.ReadAllText("vision.json");
return contents;
}
我已登录Azure Portal中提供的ftp帐户并上传了该文件。
但是抛出了File not found异常
System.Web.Services.Protocols.SoapException: 'Server was unable to process request. ---> Could not find file 'D:\Windows\system32\vision.json'.'
尝试使用json文件的完整路径。
Environment.ExpandEnvironmentVariables(@"%HOME%\site\wwwroot\vision.json")