简体   繁体   English

Web服务-Azure云服务中未找到文件异常

[英]Web Service - File Not Found Exception in Azure Cloud Service

I'm trying to read a file using a web method 我正在尝试使用网络方法读取文件

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

        }

I have logged in to the ftp account provided in Azure Portal and uploaded the file. 我已经登录到Azure门户中提供的ftp帐户并上传了文件。 在此处输入图片说明

But File not found exception is thrown 但是抛出文件未找到异常

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")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM