How to have multiple bin folders in an asp.net application?

北慕城南 提交于 2020-01-01 18:19:34

问题


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.

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.

So,

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

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

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

many thanks,


回答1:


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>

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




回答2:


1- Create a Bin folder yourself in the root folder of the website in IIS
2- Search for *.dll in your project and paste the DLLs in the Bin folder created in step 1 (it will find all the dlls inside inner bin folders)

i have fixed my missed assemblies in asp.net ckfinder + ckeditor apps hosted in IIS for testing



来源:https://stackoverflow.com/questions/12057526/how-to-have-multiple-bin-folders-in-an-asp-net-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!