替代GAC的MVC站点之间共享code [英] Alternatives to GAC for sharing code between mvc sites

查看:189
本文介绍了替代GAC的MVC站点之间共享code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们有,我们用它来输出HTML /字符串,它充当我们的Web应用程序中常见的菜单海关总署注册的C#对象。

Currently, we have c# object registered in the gac which we use to output a html/string which acts as a common menu for our web applications.

GAC中登记对象的好处是,我们可以更新GAC对象和引用它获取更新非常有效的所有应用程序。 HTML菜单引用一些JS和CSS资源在公共位置。

The benefit of the gac registered object is that we can update the gac object and all applications that reference it get the updates very efficiently. The html menu references some js and css resources at a common location.

C#的对象不执行基于服务器/环境的一些逻辑等。

The c# object does perform some logic based on servers/environments etc.

是否有替代品比GAC对象以外来执行类似的功能。

Are there alternatives other than GAC objects to perform similar functionality.

我曾考虑过引用从另一个项目/控制器MVC的看法,但有(即在菜单中的页面后剩下的渲染)延迟问题。我觉得当作为页面的一部分呈现的效果最好。

I had considered reference a mvc view from another project/controller but there was latency issues (i.e. the menu was rendered after the rest of the page). I feel it works best when rendered as part of the page.

其他的想法/创意/选项?

other thoughts/ideas/options?

推荐答案

我相信你可以使用web.config中手动指示各自网站上找到一个特定的组件在一个共同的位置:

I believe you can use web.config to manually instruct each site to find a particular assembly at a common location:

http://msdn.microsoft。 COM / EN-US /库/ 4191fzwb(V = VS.90)的.aspx

从文章:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="myAssembly"
                           publicKeyToken="32ab4ba45e0a69a1"
                           culture="en-us" />
         <codeBase version="2.0.0.0"
                   href="http://www.litwareinc.com/myAssembly.dll"/>
       </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

另外,你可以设置探​​测来搜索整个目录为常见的库(也从文章):

Alternatively, you could setup "probing" to search entire directories for your common libraries (also from the article):

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

这篇关于替代GAC的MVC站点之间共享code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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