I have an IIS-hosted WCF service and I am trying to use Directory.Exists()
method. If nonexistent network location is passed, this method hangs. I've googled for it and found that it's "kind of ok" due to Directory.Exists()
inner implementation. But I wrote a simple console application which does the same and Directory.Exists()
never hangs, always returns 'false
'. I run the application under my (admin) account and IIS pool is running under 'Network Service'.
Do you have any ideas why? What is the difference between doing the same inside a service or a console application?
This might be caused due to user authorization control stuff that is present in Windows (remember when you try to access a folder that you dont have access in Windows? It kind of waits a long time to answer "You can't access,..." or something like that).
Which is the user you are running the application? Your user id (as per what you said you can access that folder running the console application) is able to see that folder.
So, try to run the application as your own user id.
Furthermore, check this link: https://stackoverflow.com/a/21385162/1378854
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With