Forum Discussion
Endless WebDAV requests caused by WqlEventQuery
Hi,
I'm facing problems when mapping a drive via WebDAV and simultaneously using WqlEventQuery to monitor created or deleted logical disks.
1. WebDAV:
The network drive is mapped to a folder e.g. http://192.168.178.10/folder. Here it is important that the network device does not allow access to http://192.168.178.10/ and will respond with a 403 status code if that "root" folder is accessed via e.g. PROPFIND.
I have also set up a WebDAV server on localhost for troubleshooting which is configured to behave equally.
2. WqlEventQuery:
I need to monitor whenever logical drives are created and do this using a WqlEventQuery and ManagementEventWatcher (in C#) which looks like "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA Win32_LogicalDisk".
Now the issue is that as soon as the ManagementEventWatcher is started, Windows tries to access the mapped WebDAV drive but not using the path which was used for mapping. Instead it tries to access the devices "root" folder "http://192.168.178.10)" which obviously will be answered with 403. These accesses keep happening as long as the ManagementEventWatcher is running. Below you can also find a screenshot of what it looks like on my testserver on localhost.
Every second I get 4 PROPFIND requests to "/". The issue here is that this causes the MsMpEng.exe to consume quite some CPU time and the mouse cursor is constantly flickering and showing the loading cursor.
I also found that the process hosting the WebDAV client service (svchost with ref to webclnt.dll)
continuously spawns new processes of executable rundll32.exe with the following entrypoint/command:
davclnt.dll, DavSetCookie (probably that's also why MsMpEng is becoming active).
Does anybody have an idea why this happens and how I could manage to have both WebDAV and the WqlEventQuery running without these weird accesses?
3 Replies
- EansdeanIron Contributor
It appears that Windows tries to access the WebDAV drive's root (e.g., /) via PROPFIND requests, possibly to gather information or verify the drive's status.
- StreittinIron Contributor
Instead of monitoring all logical disk events, try to narrow down the query to only those events that are relevant to your use case. For example, if you only need to know when a drive is created, filter the query to only include the specific event that indicates drive creation (e.g., EventID 1000). This reduces the chance of triggering unnecessary events.
- KoenpkIron Contributor
Windows' WebDAV client (via webclnt.dll) and the WMI event system are interacting in a way that triggers the WebDAV client to perform certain filesystem operations (like checking for disk presence or status). When WMI queries are active, Windows may perform background checks or queries that involve probing the WebDAV drive.