【问题标题】:remoting error: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed远程错误:由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef
【发布时间】:2016-10-06 07:56:10
【问题描述】:

我对 AppServerSqlServerDataUtil 类使用远程处理。

配置文件:

客户:

<configuration>
  <system.runtime.remoting>
    <application >
      <client url="tcp://172.22.110.25:8086">
        <activated  type="DealsRoomDAL.AppServerSqlServerDataUtil, DealsRoomDAL"/>
      </client>     
      <channels>
        <channel ref="tcp" secure="true" >
          <serverProviders>
            <formatter ref="soap" typeFilterLevel="Full" />
            <formatter ref="binary" typeFilterLevel="Full"/>
          </serverProviders>

        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

服务器:

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

<configuration>
  <system.runtime.remoting>
    <customErrors mode="off"/>
    <application>
      <service>
        <activated   type="DealsRoomDAL.AppServerSqlServerDataUtil, DealsRoomDAL"/>
      </service>

      <channels>
        <channel ref="tcp" port="8086"  secure="true" machineName="prblalsmtrbx.bnhpgroup.com" >
          <clientProviders>
            <formatter ref="soap" typeFilterLevel="Full" />
            <formatter ref="binary" typeFilterLevel="Full"/>
          </clientProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

我有一个函数可以获取 SqlCommand 作为 AppServerSqlServerDataUtil 类的参数

public object GetScalarValue(SqlCommand com)
        {
          ...
        }

当我尝试调用 GetScalarValue 时出现错误:

由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef。

当我在 AppServerSqlServerDataUtil 上调用其他包含简单输入参数(如字符串)的函数时,没有问题。

【问题讨论】:

    标签: .net remoting .net-remoting


    【解决方案1】:

    问题似乎与 SqlCommand 参数有关。 它不可序列化。 错误信息虽然很混乱。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 2010-12-03
      • 2016-11-26
      • 2012-03-05
      • 2022-08-02
      • 2018-03-06
      相关资源
      最近更新 更多