在子文件夹中运行 ASP.NET 网站

发布于 2024-08-06 09:01:49 字数 309 浏览 7 评论 0原文

有没有办法在网站的子文件夹中运行 ASP.NET 网站?

举个例子,假设我想运行 Screwturn wiki (http://www.screwturn.eu/)在我的网站上名为“wiki”的文件夹中,我可以更改 Screwturn 网站的 web.config 以告诉它它在“wiki”文件夹中运行吗? (就像说“~/”=“/wiki/”)

然后wiki将在“/wiki/bin”中找到“~/bin”中的程序集,并且对于新根目录下的所有其他文件夹也是如此。

Is there a way of running an ASP.NET website in a subfolder of the website?

As an example, say I wanted to run the screwturn wiki (http://www.screwturn.eu/) in a folder called "wiki" on my website, can I alter the web.config of the screwturn website to tell it that it is running in the "wiki" folder? (like saying that "~/" = "/wiki/")

The wiki would then find its assemblies that are in "~/bin" in "/wiki/bin" and the same for all other folders below the new root.

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

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

发布评论

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

评论(5

上课铃就是安魂曲 2024-08-13 09:01:50

我最近必须这样做,并且将 wiki 文件夹作为一个应用程序(如前面的答案中所建议的),我还必须放置一个虚拟的“App_Themes ->”由于父应用程序的 Web.config 中存在 标记,因此 Wiki 应用程序中的顶级文件夹位于 Wiki 应用程序的顶层。小技巧,但这就是我喜欢在 Asp.Net 中配置样式的方式,而且我不想更改它。

I had to do this recently, and having made the wiki folder an application (as suggested in the previous answers) I also had to place a dummy 'App_Themes -> Default' folder at the top-level within the Wiki app because of the presence of the <pages styleSheetTheme="default" theme="default"> tag in the parent app's Web.config. Small hack, but that's the way I like to configure my styles in Asp.Net, and I didn't want to change that.

浅唱ヾ落雨殇 2024-08-13 09:01:50

简短的回答是可以。无需在 Web.Config 中指定文件夹的位置。

Short answer is YES you can. No need to specify the location of the folder in the Web.Config.

紙鸢 2024-08-13 09:01:49

小菜一碟,您可以将虚拟目录添加到 IIS 网站的根目录并将其指向您网站的路径,或者将其放置在网站根目录中的物理目录,然后通过右键单击将其转换为应用程序在 IIS 管理控制台中,转到属性并单击应用程序名称旁边的“创建”。

Piece of cake, you can either add a virtual directory to the root of the IIS website and point it at the path of your site or place it an a physical directory in the website root then turn it into an application by right-clicking on it in the IIS management console, going to properties and clicking "Create" next to application name.

阳光下的泡沫是彩色的 2024-08-13 09:01:49

您需要停止根 web.config 文件中的配置继承,以便 wiki web.config 不会从根 web.config 读取任何内容。

You need to stop the configuration inheritance in the root web.config file so that the wiki web.config doesn't read anything from the root web.config.

初见 2024-08-13 09:01:49

正如其他人指出的那样。基本上你需要把它放在你的子应用程序Web.config中,当然你还需要配置域(子域等),IIS设置。

<configuration>    
  <location path="." inheritInChildApplications="false">

    //your code here

    <system.web>
      //your code here
    </system.web>

    //your code here

  </location>     
</configuration>

As others pointed out. basically you need to put this in your child application Web.config, of course you also need to configure the domain (sub domain etc.), IIS setting as well.

<configuration>    
  <location path="." inheritInChildApplications="false">

    //your code here

    <system.web>
      //your code here
    </system.web>

    //your code here

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