C#错误:找不到路径的一部分 [英] C# Error: Could not find part of the path

查看:92
本文介绍了C#错误:找不到路径的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在godaddy上托管了一个网站来存放我的照片,但由于找不到文件所在的文件夹的路径而遇到麻烦.在我的机器上,一切正常,但是当我将其安装到Godaddy的服务器上时,出现错误.以下是我的代码,可以加载一些文件,以加载文件.谢谢.

I am hosting a site on godaddy for my photos and seem to run into trouble with not being able to find the path of folder with the files. On my machine everything works fine, but when I bring it up to godaddy's server, then I get an error. Below is my code, to load the files, can someone shed a little light. Thanks.

string data = HttpContext.Current.Server.MapPath("~/Photos/thumbs");
            string[] thumbPhotos = Directory.GetFiles(data);

这是我收到的错误消息.异常详细信息:System.IO.DirectoryNotFoundException:找不到路径'C:\ Windows \ SysWOW64 \ inetsrv \〜\ Photos \ thumbs'的一部分.

Here is the error message that I receive. Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\SysWOW64\inetsrv\~\Photos\thumbs'.

推荐答案

只需删除〜使其起作用,然后稍微更改路径即可.

Just had to remove the ~ to get it to work, and change the path a little.

这篇关于C#错误:找不到路径的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆