VS2008 内的 ASP.NET 虚拟目录

发布于 2024-07-25 07:34:28 字数 230 浏览 8 评论 0原文

我正在构建一个 ASP.NET 3.5 Web 应用程序。 当我运行该项目(使用 Visual Studio 的内置服务器)时,它需要能够将网络共享作为虚拟目录进行访问。 我似乎找不到任何有关如何执行此操作的信息。

网络资源非常大,更新频繁,并且被其他开发人员和其他项目项目使用——不仅仅是我和我的。

据我所知,一旦部署站点,我就可以在网络路径中创建一个 IIS 虚拟目录,但这在我调试时没有帮助。

I'm building an ASP.NET 3.5 web application. When I run the project (using Visual Studio's built-in server), it needs to be able to access a network share as a virtual directory. I can't seem to find any information about how to do this.

The network resource is very large, is updated frequently, and is used by other developers and in other projects projects--not just me and mine.

I understand that I can create an IIS virtual directory to the network path once the site is deployed, but that doesn't help me while I'm debugging.

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

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

发布评论

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

评论(2

走过海棠暮 2024-08-01 07:34:28

您无法使用 Web 开发服务器执行此操作。 它用于调试单个应用程序,而不是依赖于多个虚拟目录的应用程序。

它如何引用映射到共享的虚拟目录? 通过重定向到该虚拟目录下的资源? 如果是这样,那么在调试过程中,是否可以将其重定向到的位置更改为 IIS 虚拟目录?

You can't do this with the web development server. It's for debugging a single application, not one that depends on multiple virtual directories.

How does it reference the virtual directory mapped to the share? By redirecting to resources under that virtual directory? If so, then during debugging, could you just change the location it redirects to to be an IIS virtual directory?

街角迷惘 2024-08-01 07:34:28

现在可以使用较新版本的 Visual Studio 和 IIS Express 同时拥有虚拟目录和子应用程序。

  1. 在您选择的文本编辑器中打开 .vs\All\config\applicationhost.config,然后导航到 configuration/system.applicationHost/sites 节点。 p>

  2. 更新与您的父应用程序对应的 site 元素,如下所示:

: :

<site name="Web" id="1">
    <!-- parent application -->
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:5706:localhost" />
        <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>

修改:

<site name="Web" id="1">
    <!-- parent application -->
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Web" />
        <!-- virtual directory -->
        <virtualDirectory path="/DocRoot" physicalPath="C:\Src\DocRoot" />
    </application>
    <!-- sub-application -->
    <application path="/FooBar" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Foo Bar" />
        <!-- virtual directory; shared with parent app, so must be duplicated -->
        <virtualDirectory path="/DocRoot" physicalPath="C:\Src\DocRoot" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:5706:localhost" />
        <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>
  1. 保存并重新启动IIS Express。

It's now possible to have both virtual directories and sub-applications with newer versions of Visual Studio and IIS Express.

  1. Open .vs\All\config\applicationhost.config in your text editor of choice, then navigate to the configuration/system.applicationHost/sites node.

  2. Update the site element that corresponds to your parent application, like so:

Original:

<site name="Web" id="1">
    <!-- parent application -->
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:5706:localhost" />
        <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>

Modified:

<site name="Web" id="1">
    <!-- parent application -->
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Web" />
        <!-- virtual directory -->
        <virtualDirectory path="/DocRoot" physicalPath="C:\Src\DocRoot" />
    </application>
    <!-- sub-application -->
    <application path="/FooBar" applicationPool="Clr4IntegratedAppPool">
        <!-- application root -->
        <virtualDirectory path="/" physicalPath="C:\Src\Foo Bar" />
        <!-- virtual directory; shared with parent app, so must be duplicated -->
        <virtualDirectory path="/DocRoot" physicalPath="C:\Src\DocRoot" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:5706:localhost" />
        <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>
  1. Save and restart IIS Express.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文