简体   繁体   English

使〜/引用根文件夹(与web.config相同的文件夹)

[英]Make ~/ reference the root folder (the same folder as web.config is in)

I'm working on a site in asp.net (my first) which is all going very well. 我正在asp.net上的网站上工作(我的第一个网站),一切进展顺利。 That is until I deployed the app to our test environment, where the ~ (tilde) started referencing a folder parent to the root of my project. 直到我将应用程序部署到我们的测试环境之前,〜(波浪号)开始将父文件夹引用到我项目的根目录。

On my computer the app lives in c:/Documents.../Visual Studio../WebSites/MyApp and ~ resolves correctly. 在我的计算机上,该应用程序位于c:/ Documents ... / Visual Studio ../ WebSites / MyApp中,并且〜可以正确解析。

On the test server it lives in a subfolder to an existing site, so the url to the site (both while testing and once it goes live) is something like domain.com/oldexistingsite/myapp. 在测试服务器上,它位于现有网站的子文件夹中,因此该网站的网址(在测试时以及一旦启用)都类似于domain.com/oldexistingsite/myapp。

On the test server ~/ resolves to the root of domain.com which breaks the urls to my user controls registered in web.config and all other urls using the ~ operator to make relative urls. 在测试服务器上,〜/解析为domain.com的根目录,该根目录将URL分解为我在web.config中注册的用户控件以及使用〜运算符创建相对URL的所有其他URL。

Is there any way I can ensure that the ~ operator will resolve paths relative to the root of my app (ie the same folder where web.config file for my app is located)? 有什么方法可以确保〜运算符解析相对于我的应用程序根目录的路径(即,用于我的应用程序的web.config文件所在的文件夹)?

Sorry if this is something totally trivial - this is all new to me ;) 抱歉,如果这完全是微不足道的-这对我来说是新的;)

Sounds like you didn't make the subfolder an application in IIS; 听起来好像您没有将子文件夹用作IIS中的应用程序。 In IIS Manager on the server right click on the subfolder and hit properties, then create an application for the folder. 在服务器上的IIS管理器中,右键单击子文件夹并单击属性,然后为该文件夹创建一个应用程序。 Sorry, I don't have IIS installed on my home PC or I'd give you more complete instructions... 抱歉,我的家用PC上没有安装IIS,或者我将为您提供更完整的说明...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM