I开发者_如何转开发 have a crystal report in the root directory of the .Net Windows service application. If it is a web application I specify something like below
rptDoc.Load(Server.MapPath("myReport.rpt"));
How do I need to specify if it is a windows service?
thanks in advance.
Try this: Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
When your hosting a windows service, the current directory can sometimes be tricky to obtain.
精彩评论