开发者

WCF Security Exception caused by Directory.Delete()

开发者 https://www.devze.com 2022-12-19 12:21 出处:网络
I am encountering a strange issue: I call a WCF-Operation from my client. The operation deletes all files in a specified directory and finally deletes their parent directory too.

I am encountering a strange issue: I call a WCF-Operation from my client. The operation deletes all files in a specified directory and finally deletes their parent directory too.

ACtually, this works. No exception is thrown and the files within the folder and the folder itself are deleted successfully.

But: the 开发者_如何学运维wcf context of my client gets invalidated so I need to instantiate the Service Client again. If I do not delete the directory but only the files within everything works fine. Actually I do not have any clue why deleting a directory has an impact on the Client calling the service ??!

Thank You


Sorry for the late reply, but I just wasted an afternoon dealing with the exact same issue. I finally tracked down the issue to the call to Directory.Delete(). It was working fine, no exceptions etc.

In our case we were deleting a subfolder of the folder that hosted the WCF service. From what I understand, this forces the application to recycle, killing your session/service etc

Our service was storing/deleting files, so we moved the file storage location to outside of the applications folder and it now seems to work fine.

More info here:

http://www.geekays.net/post/2008/10/14/ASPNET-webdomain-recycle-on-subfolder-changes.aspx


Are you getting back a SOAP fault from your service call when you delete the directory??

If so, can you enable additional detailed debug information to find out what exactly that fault is on the server??

You do this by adding a service behavior to your config (on the server side):

<behaviors>
   <serviceBehavior name="detailedDebugInfo">
       <serviceDebug includeExceptionDetailInFaults="True" />
   </serviceBehavior>
</behaviors>

and then assigning that service behavior configuration to your service declaration:

<services>
    <service name="YourService" 
             behaviorConfiguration="detailedDebugInfo">

Once you do this, you should be getting back the detailed exception info from a potential server side exception into the SOAP fault you're getting back on the client.

0

精彩评论

暂无评论...
验证码 换一张
取 消