本文介绍了.NET Remoting随机客户端端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用远程处理编写的应用程序。  安装在服务器上的远程服务(具有访问数据库的所有业务代码等)和使用"存根"编译的客户端GUI。到业务
代码。  运行客户端时,远程处理部件将其连接到远程服务中的正确业务代码。  这一切都很好,但它是使用set ports设计的。  客户端GUI和远程服务都配置为使用端口
8089(为什么选择该端口,我不知道)。  无论如何,我在互联网上读了一些让我相信客户端端口可以随机,但我不确定,鉴于我们的应用程序,如何实现这一点。  问题是
你一次只能在一台机器上运行一个客户端,因为它使用一个设置端口。  我们希望能够在同一台机器上运行多个客户端。



我希望能够完成客户端随机端口,我可以简单地进行配置更改和沃拉!  我已附加客户端的配置文件和远程服务的配置文件。  你能告诉我这是否可以通过
a简单的配置更改来实现,如果是这样,我会在配置文件中更改以实现这一点?

谢谢!

客户端配置文件:

<?xml version =" 1.0" encoding =" utf-8"?>

< configuration>

  <! - 这是客户端远程处理对象配置文件.-->

  < system.runtime.remoting>

    < application>

      <频道>

        < channel ref =" tcp" port =" 8089">

          < serverProviders>

            < formatter ref =" binary" typeFilterLevel =" Full">

            < / formatter>

          < / serverProviders>

        < / channel>

      < / channels>

    < customErrors mode =" Off" />
$
      < client url =" tcp:// wbrs10:8089">

        < wellknown type =" PMRCM.Business.BusinessData.AttachmentLink.Attachment_Link,PMRCM.Business" URL =" TCP:// wbrs10:8089 / Attachment_Link" />
$
        < wellknown type =" PMRCM.Business.BusinessData.AuditHistory.AuditHistory,PMRCM.Business" URL =" TCP:// wbrs10:8089 / AuditHistory" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.ConstantTranslation,PMRCM.Business" URL =" TCP:// wbrs10:8089 / ConstantTranslation" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.Culture,PMRCM.Business" URL =" TCP:// wbrs10:8089 /文化QUOT; />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.DistributionList,PMRCM.Business" URL =" TCP:// wbrs10:8089 / DistributionList" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.PlantConfig,PMRCM.Business" URL =" TCP:// wbrs10:8089 / PlantConfig" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.SystemConfig,PMRCM.Business" URL =" TCP:// wbrs10:8089 / SystemConfig" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Configuration.Users,PMRCM.Business" URL =" TCP:// wbrs10:8089 /用户和QUOT; />
$
        < wellknown type =" PMRCM.Business.BusinessData.DBAccess.DBAccess,PMRCM.Business" URL =" TCP:// wbrs10:8089 / DBACCESS" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Log.EmailQueue,PMRCM.Business" URL =" TCP:// wbrs10:8089 / EmailQueue" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Log.ErrorLog,PMRCM.Business" URL =" TCP:// wbrs10:8089 /错误日志" />
$
        < wellknown type =" PMRCM.Business.BusinessData.Log.MessageLog,PMRCM.Business" URL =" TCP:// wbrs10:8089 / MessageLog" />
$
        < wellknown type =" PMRCM.Business.BusinessData.MasterTemplate.MasterTemplates,PMRCM.Business" URL =" TCP:// wbrs10:8089 / MasterTemplates" />
$
        < wellknown type =" PMRCM.Business.BusinessData.OTIS.OTISData,PMRCM.Business" URL =" TCP:// wbrs10:8089 / OTISData" />
$
        < wellknown type =" PMRCM.Business.BusinessData.PMRCMData.EquipmentAnalysisGroup,PMRCM.Business" URL =" TCP:// wbrs10:8089 / EquipmentAnalysisGroup" />
$
        < wellknown type =" PMRCM.Business.BusinessData.PMRCMData.RCMSystem,PMRCM.Business" URL =" TCP:// wbrs10:8089 / RCMSystem" />
$
        < wellknown type =" PMRCM.Business.BusinessData.SAP.FuncLoc_Equipment,PMRCM.Business" URL =" TCP:// wbrs10:8089 / FuncLoc_Equipment" />
$
        < wellknown type =" PMRCM.Business.BusinessData.SAP.MaintenancePlanConversion,PMRCM.Business" URL =" TCP:// wbrs10:8089 / MaintenancePlanConversion" />
$
        < wellknown type =" PMRCM.Business.BusinessData.SAP.ReferenceData,PMRCM.Business" URL =" TCP:// wbrs10:8089 / ReferenceData" />
$
        < wellknown type =" PMRCM.Business.BusinessLogic.HierarchyManager,PMRCM.Business" URL =" TCP:// wbrs10:8089 / HierarchyManager" />
$
        < activated type =" PMRCM.Business.DataListProviders.PlantDataListProvider,PMRCM.Business" />
$
        < wellknown type =" PMRCM.Business.ErrorManagement.ErrorHandling,PMRCM.Business" URL =" TCP:// wbrs10:8089 / ErrorHandling中" />
$
      < / client>

    < / application>

  < /system.runtime.remoting>

< / configuration>

远程服务器配置文件:

 

  < ;! - 这是远程服务远程处理对象配置文件.-->

  <!--This is the remoting service remoting object config file.-->

  < system.runtime.remoting>

    < application>

      < service>

        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.AttachmentLink.Attachment_Link,PMRCM.Business" objectUri = QUOT; Attachment_Link" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.AuditHistory.AuditHistory,PMRCM.Business" objectUri = QUOT; AuditHistory" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.ConstantTranslation,PMRCM.Business" objectUri = QUOT; ConstantTranslation" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.Culture,PMRCM.Business" objectUri = QUOT;文化QUOT; />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.DistributionList,PMRCM.Business" objectUri = QUOT; DistributionList" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.PlantConfig,PMRCM.Business" objectUri = QUOT; PlantConfig" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.SystemConfig,PMRCM.Business" objectUri = QUOT; SystemConfig" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Configuration.Users,PMRCM.Business" objectUri = QUOT;用户和QUOT; />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.DBAccess.DBAccess,PMRCM.Business" objectUri = QUOT; DBACCESS" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Log.EmailQueue,PMRCM.Business" objectUri = QUOT; EmailQueue" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Log.ErrorLog,PMRCM.Business" objectUri = QUOT;错误日志" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.Log.MessageLog,PMRCM.Business" objectUri = QUOT; MessageLog" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.MasterTemplate.MasterTemplates,PMRCM.Business" objectUri = QUOT; MasterTemplates" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.OTIS.OTISData,PMRCM.Business" objectUri = QUOT; OTISData" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.PMRCMData.EquipmentAnalysisGroup,PMRCM.Business" objectUri = QUOT; EquipmentAnalysisGroup" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.PMRCMData.RCMSystem,PMRCM.Business" objectUri = QUOT; RCMSystem" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.SAP.FuncLoc_Equipment,PMRCM.Business" objectUri = QUOT; FuncLoc_Equipment" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.SAP.MaintenancePlanConversion,PMRCM.Business" objectUri = QUOT; MaintenancePlanConversion" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.BusinessData.SAP.ReferenceData,PMRCM.Business" objectUri = QUOT; ReferenceData" />
$
        < wellknown mode =" Singleton" type =" PMRCM.Business.BusinessLogic.HierarchyManager,PMRCM.Business" objectUri = QUOT; HierarchyManager" />
$
        < activated mode =" SingleCall" type =" PMRCM.Business.DataListProviders.PlantDataListProvider,PMRCM.Business" objectUri = QUOT; PlantDataListProvider" />
$
        < wellknown mode =" SingleCall" type =" PMRCM.Business.ErrorManagement.ErrorHandling,PMRCM.Business" objectUri = QUOT; ErrorHandling中" />
$
      < / service>

      <频道>

        < channel ref =" tcp" port =" 8089">

          < serverProviders>

            < formatter ref =" binary" typeFilterLevel =" Full">

            < / formatter>

          < / serverProviders>

        < / channel>

      < / channels>

    < / application>

    < customErrors mode =" Off" />

  < /system.runtime.remoting>

< / configuration>

  <system.runtime.remoting>
    <application>
      <service>
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.AttachmentLink.Attachment_Link, PMRCM.Business" objectUri="Attachment_Link" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.AuditHistory.AuditHistory, PMRCM.Business" objectUri="AuditHistory" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.ConstantTranslation, PMRCM.Business" objectUri="ConstantTranslation" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.Culture, PMRCM.Business" objectUri="Culture" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.DistributionList, PMRCM.Business" objectUri="DistributionList" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.PlantConfig, PMRCM.Business" objectUri="PlantConfig" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.SystemConfig, PMRCM.Business" objectUri="SystemConfig" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Configuration.Users, PMRCM.Business" objectUri="Users" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.DBAccess.DBAccess, PMRCM.Business" objectUri="DBAccess" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Log.EmailQueue, PMRCM.Business" objectUri="EmailQueue" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Log.ErrorLog, PMRCM.Business" objectUri="ErrorLog" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.Log.MessageLog, PMRCM.Business" objectUri="MessageLog" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.MasterTemplate.MasterTemplates, PMRCM.Business" objectUri="MasterTemplates" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.OTIS.OTISData, PMRCM.Business" objectUri="OTISData" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.PMRCMData.EquipmentAnalysisGroup, PMRCM.Business" objectUri="EquipmentAnalysisGroup" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.PMRCMData.RCMSystem, PMRCM.Business" objectUri="RCMSystem" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.SAP.FuncLoc_Equipment, PMRCM.Business" objectUri="FuncLoc_Equipment" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.SAP.MaintenancePlanConversion, PMRCM.Business" objectUri="MaintenancePlanConversion" />
        <wellknown mode="SingleCall" type="PMRCM.Business.BusinessData.SAP.ReferenceData, PMRCM.Business" objectUri="ReferenceData" />
        <wellknown mode="Singleton" type="PMRCM.Business.BusinessLogic.HierarchyManager, PMRCM.Business" objectUri="HierarchyManager" />
        <activated mode="SingleCall" type="PMRCM.Business.DataListProviders.PlantDataListProvider, PMRCM.Business" objectUri="PlantDataListProvider" />
        <wellknown mode="SingleCall" type="PMRCM.Business.ErrorManagement.ErrorHandling, PMRCM.Business" objectUri="ErrorHandling" />
      </service>
      <channels>
        <channel ref="tcp" port="8089">
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full">
            </formatter>
          </serverProviders>
        </channel>
      </channels>
    </application>
    <customErrors mode="Off" />
  </system.runtime.remoting>
</configuration>

 

推荐答案

如果您无法在本地计算机上创建多个客户端实例。 然后,设计中必须有一些东西使客户端表现得就像它不仅仅是典型的客户端应用程序一样。

If you are not able to create more than one instance of a client on a local machine.  Then there must be something in the design that makes the client side behave as if it is something other than just a typical client application.


这篇关于.NET Remoting随机客户端端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 02:28