【发布时间】:2008-10-24 19:33:11
【问题描述】:
场景 - 我需要访问一个 HTML 模板以从我的业务逻辑层生成一封电子邮件。它是一个类库,包含一个包含文件的子文件夹。当我在单元测试中尝试以下代码时:
string FilePath = string.Format(@"{0}\templates\MyFile.htm", Environment.CurrentDirectory);
string FilePath1 = string.Format(@"{0}\templates\MyFile.htm", System.AppDomain.CurrentDomain.BaseDirectory);
它使用的是 C:\WINNT\system32\ 或 ASP.NET 临时文件夹目录。
在不使用 app.config 或 web.config 文件的情况下访问此文件的最佳方法是什么?
[这是使用 WCF 服务]
【问题讨论】:
-
我最终将文件路径存储在 web.config 文件中。
标签: c# wcf file coding-style