如何在asp.net应用程序中拥有多个bin文件夹? [英] How to have multiple bin folders in an asp.net application?

查看:218
本文介绍了如何在asp.net应用程序中拥有多个bin文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个位于C:/ MainApp的asp.net应用程序,它有一个bin文件夹。在IIS中,我将其配置为Web应用程序,我可以运行我的测试页。

I have an asp.net application located in C:/MainApp which has a bin folder. In IIS I have configured this as a web application and I can run my test pages.

现在,我有2个带有自己的dll的Web服务应用程序而我没有想要将这些dll部署在主bin文件夹c:/ MainApp / Bin中出于某些原因,请不要问为什么!这两个子应用程序需要托管在同一个MainApp下,而不为每个子应用程序创建一个新的虚拟文件夹。

Now, I have 2 web service applications with their own dlls and I don't want to deploy those dlls in the main bin folder c:/MainApp/Bin for some reasons, please don't ask why! These 2 subapps need to be hosted under the same MainApp without creating a new Virtual Folder for each.

所以,

c:/MainApp
c:/MainApp/bin
c:/MainApp/SubApp1/bin
c:/MainApp/SubApp2/bin

如何配置webconfig以便我的SubApp文件夹可以拥有自己的bin文件夹?

How to configure the webconfig so that my SubApp folders can have their own bin folders?

如果是这样,他们是否也会在运行时从MainApp bin文件夹继承?

If so, would they inherit from the MainApp bin folder also at runtime?

非常感谢,

推荐答案

您可以在web.config中添加一个assemblyBinding元素来设置多个bin路径:

You can add an assemblyBinding element to your web.config to set multiple 'bin' paths:

<configuration>
   <runtime>   
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="bin;SubApp1\bin;SubApp2\bin"/>
      </assemblyBinding>
   </runtime>   
</configuration>

这将导致您的主Web应用程序使用<$ c中所有bin路径的DLL $ c>探测元素。

This will cause your main web application to use DLLs from all of the bin paths in the probing element.

这篇关于如何在asp.net应用程序中拥有多个bin文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆