关于.Net Remoting以IIS发布的一些心得体会

经过这次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);
  }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值