0
在開發環境IIS託管WCF訪問文件
string AppPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string path = AppPath + "\\options.xml";
作品。
當由生產IIS7服務器託管時,我把Options.xml放在bin環境中,但上述代碼生成的路徑是一個asp.net temp目錄。 那麼在開發和生產環境中訪問文件的正確技術是什麼? 感謝
聽起來像一個優雅的解決方案。充其量,我對Web.config的使用是最基本的。我會做一些挖掘。作爲利益的問題解決了即時問題與字符串path = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly()。GetName()。CodeBase)+「\\ options.xml」; – 2012-02-02 18:22:57