Folks,
I have an ASP .Net web service that I am using for a product in work. But we need to make this a more "portable" for installation on other boxes. One of the requirements is to avoid a recompile when performing different installs. Thus we can't have any hard coded paths in the service.
So I have some code I wrote for another application that happily parses an xml file and stores a load of local variables based on it's content, which should be sufficient... however the service doesn't seem to run from the same place each time, from what I gather the code is kept in a .dll file which is moved to a temporary directory on the server when the service is started, and is random each time.
What I want to know is, is it possible for a web service to be aware of the file path that the web site it is running in in IIS allowing us to reference it no matter where it is installed (Like Application.Sta rtupPath in a normal app)? OR if that is not possible is it possible in either Visual Studio or IIS to ensure that the xml file is copied across to the temp directory each time, and then user a local path (again something like Application.Sta rtupPath) that will return the current temp directory to reference it... i.e. Application.Sta rtupPath + @"\Settings.xml ";
Any help here would be greatly appreciated, thanks for you time folks!
Mark
EDIT: The "random" directory the files are being run from is like this (but different) every time...
C:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET Files\root\be74 4616\404c35e0\a ssembly\dl3\6bb 73064\0006a6c3_ 7987c901
I have an ASP .Net web service that I am using for a product in work. But we need to make this a more "portable" for installation on other boxes. One of the requirements is to avoid a recompile when performing different installs. Thus we can't have any hard coded paths in the service.
So I have some code I wrote for another application that happily parses an xml file and stores a load of local variables based on it's content, which should be sufficient... however the service doesn't seem to run from the same place each time, from what I gather the code is kept in a .dll file which is moved to a temporary directory on the server when the service is started, and is random each time.
What I want to know is, is it possible for a web service to be aware of the file path that the web site it is running in in IIS allowing us to reference it no matter where it is installed (Like Application.Sta rtupPath in a normal app)? OR if that is not possible is it possible in either Visual Studio or IIS to ensure that the xml file is copied across to the temp directory each time, and then user a local path (again something like Application.Sta rtupPath) that will return the current temp directory to reference it... i.e. Application.Sta rtupPath + @"\Settings.xml ";
Any help here would be greatly appreciated, thanks for you time folks!
Mark
EDIT: The "random" directory the files are being run from is like this (but different) every time...
C:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET Files\root\be74 4616\404c35e0\a ssembly\dl3\6bb 73064\0006a6c3_ 7987c901
Comment