如何在两个不同的网站之间共享代码? [英] How to share code between two different sites?

查看:59
本文介绍了如何在两个不同的网站之间共享代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


我发现ASP.net网站只接受带有网站目录的代码。

这在shairng代码中造成了很大的障碍。如何在两个

网站之间共享代码,比如两个非网站代码之间的共享方式?


-Pravin

解决方案

在你的网站上添加一个类型为Class的新项目,将代码放在那里你要共享的
,然后添加这个现有的课程项目到另一个

网站。

-

Harolds

Neo写道:


Hello All,


我发现ASP.net网站只接受带有网站目录的代码。

这在shairng代码中造成了很大的障碍。如何在两个

网站之间共享代码,比如两个非网站代码之间的共享方式?


-Pravin




Neo写道:


我发现ASP.net网站只接受带有站点目录的代码。

这会给shairng代码带来很大的障碍。如何在两个

网站之间共享代码,就像两个非网站代码之间的共享方式一样?



是的,你需要将你的共享代码写入类库

项目,然后将它们编译成.DLL程序集。然后你将
将这些DLL的副本分发到你想使用共享代码的任何其他
网站的/ bin文件夹中。

唯一需要注意的是,无论何时更新共享代码项目,您都必须将新的.DLL重新分发给使用它的所有网站。


另一种方法,就是写网络服务。执行常见任务,

和您的各种网站可以使用中央网络服务。

matt


如果添加类库,项目到你有的每个网站解决方案

担心dll的重新分配,你可以从网站解决方案中添加/更新类库中的代码



-

Harolds

" ma ** @ mailinator.com"写道:


>

Neo写道:


我发现ASP.net网站只接受带有网站目录的代码。

这会给shairng代码带来很大的障碍。如何在两个

网站之间共享代码,就像两个非网站代码之间的共享方式一样?



是的,你需要将你的共享代码写入类库

项目,然后将它们编译成.DLL程序集。然后你将
将这些DLL的副本分发到你想使用共享代码的任何其他
网站的/ bin文件夹中。

唯一需要注意的是,无论何时更新共享代码项目,您都必须将新的.DLL重新分发给使用它的所有网站。


另一种方法,就是写网络服务。执行常见任务,

和您的各种网站可以使用中央网络服务。


matt


Hello All,

I found that ASP.net website only accepts code withing site directory.
This creates big hurdle in shairng code. How to share code between two
websites, like the way share between two non-website code?

-Pravin

解决方案

Add a new project of type Class to your web site, place the code in there
that you want to share, and then add this existing class project to the other
web site.
--
Harolds
"Neo" wrote:

Hello All,

I found that ASP.net website only accepts code withing site directory.
This creates big hurdle in shairng code. How to share code between two
websites, like the way share between two non-website code?

-Pravin



Neo wrote:

I found that ASP.net website only accepts code withing site directory.
This creates big hurdle in shairng code. How to share code between two
websites, like the way share between two non-website code?

yes, you need to write your shared code into "class libraries"
projects, which are then compiled into .DLL assemblies. you then
distribute copies of these DLLs to the /bin folders of any other
website that youd like to make use of the shared code.

only caveat is, any time you update the shared-code project(s), you
must re-distribute the new .DLL to all the websites that use it.

another approach, is to write "web services" that perform common tasks,
and your various websites can consume the central webservice.
matt


If you add the "class libraries" project to each web site solution you have
to worry about the redistribution of the dll, and you can add/update the code
in the class libraries from either web site solution.
--
Harolds
"ma**@mailinator.com" wrote:

>
Neo wrote:

I found that ASP.net website only accepts code withing site directory.
This creates big hurdle in shairng code. How to share code between two
websites, like the way share between two non-website code?


yes, you need to write your shared code into "class libraries"
projects, which are then compiled into .DLL assemblies. you then
distribute copies of these DLLs to the /bin folders of any other
website that youd like to make use of the shared code.

only caveat is, any time you update the shared-code project(s), you
must re-distribute the new .DLL to all the websites that use it.

another approach, is to write "web services" that perform common tasks,
and your various websites can consume the central webservice.
matt


这篇关于如何在两个不同的网站之间共享代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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