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

时间:2021-12-14 10:25:40

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

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

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/")

举个例子,假设我想在我的网站上运行一个名为“wiki”的文件夹中的screwturn wiki(http://www.screwturn.eu/),我可以改变screwturn网站的web.config来告诉它它在“wiki”文件夹中运行? (比如说“〜/”=“/ 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.

然后,wiki将在“/ wiki / bin”中找到“〜/ bin”中的程序集,并在新根目录下找到所有其他文件夹中的程序集。

5 个解决方案

#1


14  

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.

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

#2


9  

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.

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

#3


4  

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.

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

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

    //your code here

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

    //your code here

  </location>     
</configuration>

#4


0  

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.

我最近必须这样做,并且已经将wiki文件夹设置为应用程序(如前面的答案所示)我还必须在Wiki应用程序的顶层放置一个虚拟的“App_Themes - > Default”文件夹,因为它存在父应用程序的Web.config中的 标记。小黑客,但这是我喜欢在Asp.Net中配置我的样式的方式,我不想改变它。

#5


-1  

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

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

#1


14  

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.

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

#2


9  

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.

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

#3


4  

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.

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

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

    //your code here

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

    //your code here

  </location>     
</configuration>

#4


0  

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.

我最近必须这样做,并且已经将wiki文件夹设置为应用程序(如前面的答案所示)我还必须在Wiki应用程序的顶层放置一个虚拟的“App_Themes - > Default”文件夹,因为它存在父应用程序的Web.config中的 标记。小黑客,但这是我喜欢在Asp.Net中配置我的样式的方式,我不想改变它。

#5


-1  

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

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