【发布时间】:2016-05-03 14:05:39
【问题描述】:
我正在使用Visual Studion 2013 和MVC4。我在每个区域的应用程序和路由规则(RegisterArea 覆盖)中使用区域。
我的公司决定将我们的 Web 应用程序升级到实时状态,现在我必须将 Calculator 附加到所有 javascript 脚本、css 和跨应用程序的所有其他路径 + 为所有 Controllers 执行此操作
我说的是来自
http://host:1234/legal-services/Wills/Index
到http://host:1234/legal-services/Calculator/Wills/Index
所以在替换了所有脚本后,我去了csproj 并为应用程序根添加了覆盖,以便它可以覆盖所有控制器,但这完全被忽略了。
我假设在覆盖主机时只能使用主机名和端口,但不能使用文件夹。
更新:
我也试过直接修改.csproj文件来改变IISUrl设置
来自<IISUrl>http://localhost:50766/legal-services/</IISUrl>
致<IISUrl>http://localhost:50766/legal-services/Calculator/</IISUrl>
但这对以太没有影响。
更新 2:
所以在C:\Users\[username]\Documents\IISExpress\config 中applicationHost.config 中的配置发生了变化,以添加额外的虚拟目录
来自
<virtualDirectory path="/" physicalPath="C:\hg\Website" />
<virtualDirectory path="/legal-services" physicalPath="C:\hg\Website" />
到
<virtualDirectory path="/" physicalPath="C:\hg\Website" />
<virtualDirectory path="/legal-services/calculator" physicalPath="C:\hg\Website" />
但是现在我遇到了不同的问题,因为我现在正在处理虚拟目录上的多个层,我得到了 403,这非常有意义,因为中间的路径 (/legal-services) 不在列表中。
当我添加时
<virtualDirectory path="/" physicalPath="C:\hg\Website" />
<virtualDirectory path="/legal-services/calculator" physicalPath="C:\hg\Website" />
<virtualDirectory path="/legal-services" physicalPath="C:\hg\Website" />
我遇到了配置错误(我假设是因为所有 3 个路径都指向同一个目录)
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
<authentication mode="Forms">
表示该路径未识别为web应用或存在web.config冲突。
如何配置它以便 path="/legal-services/calculator" 被识别为没有 web.config 冲突的应用程序?
【问题讨论】:
标签: visual-studio-2013 web-config .net-4.5 iis-express virtual-directory