C# Windows Get Assembly Path

Wİndows service ‘de exenin bulundugu yere bazen ulaşmada sıkıntı olabiliyor. (windows klasorunu görüyor servisler bazen) . Örnek exe klasorunde dosyaya erişimde yaşanan sıkıntı ….

string pathofService = System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)+@"\";
/*or*/
string pathofService = AppDomain.CurrentDomain.BaseDirectory ++@"\";

Leave a comment