在删除应用程序重新启动的目录结果 [英] Deleting a directory results in application restart

查看:228
本文介绍了在删除应用程序重新启动的目录结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个2目录(书和出口)的应用程序。
如果我们创建一本书或一本书中的目录中加入页面的ID的应用程序的页(在此为上载资源)。
如果我们删除一个页面,页面(和它的目录)从数据库和文件系统中删除。

然而,这导致了会话损失(即使重新启动应用程序)。我查阅了一些东西谷歌和发现了下面的链接
这似乎是在ASP.NET 2.0(3.5)中的问题。
有没有人有这个问题的解决方案。

我们正在考虑编写将在晚上清理目录服务。
但是,一定是这个另一种解决办法没有?
哦,并把该目录的虚拟目录以外是不是一种选择。


解决方案

  

呵呵,并把该目录外
  虚拟目录不是
  选项​​。


把目录的虚拟目录以外是我发现的唯一的解决方案(到目前为止)。你可以做什么,是为了让该目录似乎是虚拟目录内创建文件系统的链接(路口),例如:


  • 我们的网站(虚拟目录)位于C:\\ projectX创建\\网站

  • 数据目录(这里我们创建/删除文件和文件夹)位于C:\\ projectX创建\\数据

  • 然后我们创建了一个链接,这将使得数据的文件夹C:\\ projectX创建\\网站\\数据

该链接使用程序Linkd.exe(在Windows资源工具包提供),用下面的命令创建的:

  LINKD C:\\ projectX创建\\网站\\数据c:\\ projectX创建\\数据

现在C:\\ projectX创建\\网站\\数据链接/路口指向真实的数据目录。您可以使用链接的工作就好像它是一个物理目录。

例如。在你的网站就可以使用这个code访问:

 使用Server.Mappath(〜/数据)

你也可以使用Windows文件浏览器,浏览到C:\\ projectX创建\\网站\\数据。看起来就像一个真正的目录。

I have an application with 2 directories (books and export). If we create a book or a page of a book in the application a directory is added with the id of the page (this is for uploading resources). If we delete a page, the page (and it's directory) is removed from the database and the filesystem.

However this resulted in a session loss (even an application restart). I've looked up some thing on google and found the following link. It seems to be a problem in ASP.NET 2.0 (and 3.5). Does anyone have a solution for this problem.

We are now thinking about writing a service that will clean up the directories at night. But there has got to be another solution for this no? Oh and putting the directory outside the virtual directory is not an option.

解决方案

Oh and putting the directory outside the virtual directory is not an option.

Putting the directory outside the virtual directory is the only solution I found (so far). What you can do, is to create a link (junction) in the file system so that the directory appears to be inside the virtual directory, e.g:

  • Our web site (virtual directory) is located at C:\projectX\website
  • the data directory (where we create/delete files and folders) is located at C:\projectX\data
  • then we create a link which makes the data folder available as C:\projectX\website\data

The link is created using the program Linkd.exe (available in the windows resource kit), with the following command:

linkd c:\projectX\website\data c:\projectX\data

Now c:\projectX\website\data is a link/junction which points to the real data directory. You can work with the link as if it were a physical directory.

E.g. in your web site you can access it using this code:

Server.MapPath("~/data")

And you can also used the windows file explorer and browse to C:\projectX\website\data. It appears just like a real directory.

这篇关于在删除应用程序重新启动的目录结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆