获取 AppHarbor 上的文件内容
我最近开始在 AppHarbor 上创建一个项目只是为了尝试一下。我遇到了一个小问题。我创建了包含 jQuery 模板的小文件,我将其命名为 .tmpl-files 并将其放置在“~/Templates/”内。为了获取这些文件之一的内容,我使用 HttpRequest.Current.Server.MapPath(path);
和 File.Open
,这一切都在我的设备上完美运行。但是,在本地计算机上,在 AppHarbor 上我发现该文件不存在。有没有解决方法可以使这项工作正常进行?我是否需要以某种方式标记文件,或者是否可以在 Web.config/project-settings 中放入一些内容来实现此目的?
I recently started to create a project on AppHarbor just to try it out. And I've run into a small problem. I've created small files containing jQuery-templates which I've named .tmpl-files and placed inside "~/Templates/". To get the content of one of these files I use HttpRequest.Current.Server.MapPath(path);
, and File.Open
, and this all just works perfectly on my local machine, however, on AppHarbor I get that the file does not exist. Is there a workaround to make this work? Do I need to mark the files in some way, or is there something I can put inside my Web.config/project-settings that can make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请务必将文件标记为
Content
(在解决方案资源管理器中右键单击文件,将Build Action
设置为Content
)。如果您不这样做,该文件将不会包含在 msbuild 输出中,因此 AppHarbor 不会部署该文件。Be sure to mark the files as
Content
(right click file in Solution Explorer, setBuild Action
toContent
). If you don't do this, the file will not be included in the msbuild output and thus not deployed by AppHarbor.