【问题标题】:Web Service - File Not Found Exception in Azure Cloud ServiceWeb 服务 - Azure 云服务中未找到文件异常
【发布时间】:2019-03-05 09:16:01
【问题描述】:

我正在尝试使用网络方法读取文件

  [WebMethod]
        public string getjson()
        {
            string contents = File.ReadAllText("vision.json");
            return contents;

        }

我已经登录到 Azure 门户中提供的 ftp 帐户并上传了文件。

但抛出未找到文件异常

System.Web.Services.Protocols.SoapException: 'Server was unable to process request. ---> Could not find file 'D:\Windows\system32\vision.json'.'

【问题讨论】:

    标签: c# .net azure web-services asmx


    【解决方案1】:

    尝试使用 json 文件的完整路径。

    Environment.ExpandEnvironmentVariables(@"%HOME%\site\wwwroot\vision.json")
    

    【讨论】:

      猜你喜欢
      • 2016-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-09
      相关资源
      最近更新 更多