Directory.Delete() 导致的 WCF 安全异常

发布于 2024-08-21 00:21:37 字数 222 浏览 3 评论 0原文

我遇到一个奇怪的问题:我从客户端调用 WCF 操作。该操作将删除指定目录中的所有文件,并最终删除其父目录。

事实上,这确实有效。没有引发任何异常,并且文件夹内的文件和文件夹本身已成功删除。

但是:我的客户端的 wcf 上下文已失效,因此我需要再次实例化服务客户端。如果我不删除目录,而只删除其中的文件,则一切正常。实际上我不知道为什么删除目录会对调用服务的客户端产生影响??!

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

许一世地老天荒 2024-08-28 00:21:38

抱歉回复晚了,但我只是浪费了一个下午来处理完全相同的问题。我最终找到了对 Directory.Delete() 的调用的问题。它工作正常,没有例外等。

在我们的例子中,我们删除了托管 WCF 服务的文件夹的子文件夹。据我了解,这会强制应用程序回收,杀死您的会话/服务等。

我们的服务是存储/删除文件,因此我们将文件存储位置移动到应用程序文件夹之外,现在看起来工作正常。

更多信息请参见:

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

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

多情出卖 2024-08-28 00:21:38

当您删除目录时,您是否会从服务调用中返回 SOAP 错误?

如果是这样,您能否启用额外的详细调试信息来找出服务器上到底出现了什么错误?

您可以通过向配置(在服务器端)添加服务行为来实现此目的:

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

然后将该服务行为配置分配给您的服务声明:

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

执行此操作后,您应该从潜在的服务器端异常中获取详细的异常信息进入客户端返回的 SOAP 错误。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文