question

LieberAdam-4366 avatar image
0 Votes"
LieberAdam-4366 asked SamWu-MSFT commented

IIS change location of web.config file

I have a web server with a virtual directory to D:\test hosted as a critical web application.
When a user navigates to \\testserver\test in a web browser it pulls up the entire file contents of D:\Test.
The web.config file is located in D:\Test is there anyway to move the config file to another directory?
I experienced a problem yesterday where the web.config file was missing from the server and thus i had to rebuild it from scratch. I am unsure what happened to the file as it was not recorded via 4663 file delete events

D:\test is also setup as a file share for users to upload files to this location however they should not have deleted the file.

Please advise how I can redirect the location of the web.config so that it cannot be deleted.

Thanks,

windows-server-iis
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@LieberAdam-4366 By default, the web.config file will not be deleted, you can try to set the web.config file to read-only, and then try again to see if you can get the reason why the web.config file was deleted.

0 Votes 0 ·

ill try setting it to read only. Previously i had changed the permissions to only allow certain people access to delete the file but i am not sure how it got deleted. This iis server has been in production for 3 months without any problems and then exactly 90 days in it fails.

0 Votes 0 ·

@LieberAdam-4366 Open the Event Viewer and search the security log for event ID 4656 with a task category of "File System" or "Removable Storage" and the string "Accesses: DELETE". Review the report. The "Subject: Security ID" field will show who deleted each file.

0 Votes 0 ·

0 Answers