在子文件夹中运行 ASP.NET 网站
有没有办法在网站的子文件夹中运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我最近必须这样做,并且将 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.简短的回答是可以。无需在 Web.Config 中指定文件夹的位置。
Short answer is YES you can. No need to specify the location of the folder in the Web.Config.
小菜一碟,您可以将虚拟目录添加到 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.
您需要停止根 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.
正如其他人指出的那样。基本上你需要把它放在你的子应用程序Web.config中,当然你还需要配置域(子域等),IIS设置。
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.