经过这次MIS课程设计 我掌握了一些Remoting 技巧以IIS发布的方法为:
首先将要发布的工程以网站的方式发布出去。需要有配置文件。特别要注意的是在IIS目录里面右击网站目录,选择属性。将要发布的Remoting的安全属性设置为允许匿名访问。确定。否则会返回401错误。然后在配置文件里面加入<system.runtime.remoting>
<application>
<service>
<!--需要发布成remoting的类以及它们的URI. type的结构是"assembly名称,类名"-->
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.ArticalManage.NewsCenter, Newegg.CDBranchSite.BusinessLogic"
objectUri="NewsCenter_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.ArticalManage.ArticleCenter, Newegg.CDBranchSite.BusinessLogic"
objectUri="ArticleCenter_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.ArticalManage.SingleArticle, Newegg.CDBranchSite.BusinessLogic"
objectUri="SingleArticle_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.AdminManage.SecrityManager, Newegg.CDBranchSite.BusinessLogic"
objectUri="SecrityManager_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="EHR.Attendance.Logic.Att_Event_Logic, EHR.Attendance.Logic"
objectUri="Att_Event_LogicUrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.AdminManage.UserManager, Newegg.CDBranchSite.BusinessLogic"
objectUri="UserManager_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.AdminManage.RoleManage,Newegg.CDBranchSite.BusinessLogic"
objectUri="RoleManage_UrlService_v_1_1_1.soap" />
<wellknown mode="Singleton"
type="Newegg.CDBranchSite.BusinessLogic.RecruitProtal.PositionManager,Newegg.CDBranchSite.BusinessLogic"
objectUri="PositionManager_UrlService_v_1_1_1.soap" />
</service>
<channels>
<channel ref="http server">
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
<customErrors mode="Off" />
</system.runtime.remoting>
在客户端配置文件加入:<appSettings>
<add key="CommonPagerPageSize" value="10"/>
<add key="FCKeditor:BasePath" value="~/Newegg.CDBranchSite.Presentation.Admin/"/>
<add key="FCKeditor:UserFilesPath" value="/Newegg.CDBranchSite.Presentation.Admin/UserFiles"/>
<!--Remoting Uri地址配置开始-->
<add key="IPAM_PayrollCalc_GetNewsCenterUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/NewsCenter_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetArticleCenterUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/ArticleCenter_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetSingleArticleUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/SingleArticle_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetSecrityManagerUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/SecrityManager_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetUserManagerUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/UserManager_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetRoleManageUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/RoleManage_UrlService_v_1_1_1.soap"/>
<add key="IPAM_PayrollCalc_GetPositionManageUrl" value="http://127.0.0.1/Newegg.CDBranchSite.BusinessLogic/PositionManager_UrlService_v_1_1_1.soap"/>
<!--Remoting Uri地址配置结束-->
</appSettings>
这样一一对应。客户端也为ASp.net网站工程 调用代码为:private void GetRemoteObject()
public class WebForm1 : System.Web.UI.Page
{
private IFindGrade fGradeObj;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
GetRemoteObject();
try
{
float a = fGradeObj.Add(1,1);
}
catch(Exception ex)
{
string str= ex.Message;
Response.Write(str);
}
}
private void GetRemoteObject()
{
string sdkConnect = ConfigurationSettings.AppSettings["GetAdd_Url"];
fGradeObj = (IFindGrade)Activator.GetObject(typeof(IFindGrade),sdkConnect);
}