views:

48

answers:

3

I am using a 3rd party component which creates settings files based on hard-coded file paths i.e. they are compiled into the DLL e.g.

%APPDATA%\Vendor\Settings.ini

I have created a few console/service applications that use this and work very well. However, I am now trying to use a similar approach via my ASP.NET MVC web application and the settings file never seems to write out!

Usually if the application is running under my acconut for example the file would be written to somewhere like:

C:\Documents and Settings\James\Application Data\Vendor\Settings.ini

So I thought if the website AppPool was running under the same account the file would be saved to the same place....However, it never appears. The account is an admin account running under Windows server 2003.

Any ideas?

Thanks.

+1  A: 

Have you checked to see if the settings file is created in the App_Data folder in the web application? If not, could you put an existing settings file there and see if it uses it?

tvanfosson
Check the App_Data folder, nothing getting written there. Weird thing is, this works fine on my Dev machine when I run under Visual Studio which is running Windows 7 x64 which consequently is IIS7.0.
James
Works on your dev machine because the web server is running with your credentials. Did you try supplying a settings file in App_Data and checking if it uses it?
tvanfosson
Yes tried placing a settings file in the App_Data never worked though. Where would that particular directory resolve to when running via a website? Is it usually the App_Data folder? Perhaps I should just manually create a settings file and place it in the expected folder rather than relying on the dll to do it for me.
James
I've never actually used it with the shell variable mapping, typically when I use the App_Data folder I resolve it using Server.MapPath( "~/App_Data/..." ). You might try creating a service account on the web server, put it in the worker process group, use it to run your web site and put the settings file in its AppData folder -- probably need to login with it once to create the structure.
tvanfosson
Hmm well the odd thing is I am running the website under my login for the webserver which has all the directory structure, but the settings file doesn't get written out. However, if I place a settings file in the directory manually it will get used. Seems to be an issue with the website mapping the %APPDATA% directory.
James
A: 

It's not about the webpool account, it's about guest user's account.

Go to the properties of your site in IIS, Directory Security and in the anonymous access click on the Edit button, there you'll see wich account is been used when someone access your site.

VinTem
@VinTem, at the moment I am not allowing `anonymous` access to the site, it is set to `Integrated Windows Authentication`. I have a log which checks what account the website is being run under and it is the account which is being authenticated. Which makes it all the more unusual why the settings are being written to the correct path.
James
A: 

Couldn't find a solution to this, so I decided to develop a local WCF service (which would create the settings file in the correct directory path) and just accessed it via my web application.

James