标签: remoting

C#Remoting - 如何关闭CustomErrors

当我尝试使用远程连接到我的服务器应用程序时出现以下错误:

连接到远程服务器时似乎出现了问题:
服务器遇到内部错误.有关更多信息,请关闭服务器.config文件中的customErrors.

这是我的服务器应用程序上的代码:

TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);
Run Code Online (Sandbox Code Playgroud)

它似乎第一次工作,但除非重新启动服务器应用程序,否则会发生错误.

我猜想有些东西没有被正确清理,但我不确定是什么因为customError仍然存在.

我开始的任何想法.谢谢.

[编辑] - 感谢Gulzar,我将上面的代码修改为以下内容,现在显示错误:

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);
Run Code Online (Sandbox Code Playgroud)

.net c# remoting custom-errors

31
推荐指数
2
解决办法
3万
查看次数

可以捕获环回流量的Windows数据包嗅探器?

(这是我之前关于测量.NET远程流量的问题的后续内容.)

当我测试我们的Windows服务/服务控制器GUI组合时,在我的开发盒上运行这两个部分通常是最方便的.通过此设置,两者之间的远程通信是通过环回,而不是通过以太网卡.

是否有任何软件包嗅探器可以捕获WinXP机器上的环回流量?Wireshark是一个很棒的软件包,但它只能捕获Windows机器上的外部流量,而不是环回.

.net windows networking remoting

29
推荐指数
3
解决办法
3万
查看次数

Java:没有安全管理器:RMI类加载器被禁用

嗨,我有RMI应用程序,现在我尝试从我的客户端调用服务器上的一些方法.我有以下代码:

public static void main(final String[] args) {
    try {
        //Setting the security manager

        System.setSecurityManager(new RMISecurityManager());
        IndicatorsService server = (IndicatorsService) Naming
                .lookup("rmi://localhost/" + IndicatorsService.SERVICE_NAME);
        DataProvider provider = new OHLCProvider(server);
        server.registerOHLCProvider(provider);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (NotBoundException e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

服务器已正确加载,但当我尝试调用时,server.registerOHLCProvider(provider);我收到以下错误:

     java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
    java.lang.ClassNotFoundException: sk.xorty.client.providers.OHLCProvider (no security manager: RMI class loader disabled)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:336) …
Run Code Online (Sandbox Code Playgroud)

java networking remoting rmi securitymanager

26
推荐指数
3
解决办法
9万
查看次数

PowerShell远程处理给出"访问被拒绝"错误

我正在尝试使用PowerShell远程处理从远程域中的服务器检查某些磁盘大小,但我运行的命令无法正常工作.

情况是这样的:

  • 源服务器位于域A中
  • 目标服务器位于域B中
  • 这些域之间没有信任

域B中的服务器正在运行Exchange 2010,我可以使用此命令从服务器A对其运行Exchange 2010特定命令:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri $ConnectionURI -Credential $Credentials -Authentication Basic
Import-PSSession $Session
Run Code Online (Sandbox Code Playgroud)

问题是我无法使用此会话对此服务器运行任何非Exchange命令,如果我尝试然后它说它无法理解命令.我已经检查并使用Invoke-Command运行Get-Command,并且设置为我建立的会话的-Session变量仅返回Exchange命令.

所以我想我会尝试使用Invoke-Command和相关的ComputerName,身份验证类型和凭据,但这是失败的:

Invoke-Command -ScriptBlock {Get-Service} -ComputerName "Servername.destination.com" -Credential $Credentials -Authentication "Basic"
Run Code Online (Sandbox Code Playgroud)

这是错误:

[servername.destination.com] Connecting to remote server failed with the following error message : The WinRM client can
not process the request. The authentication mechanism requested by the client is not supported by the server or unencry
pted traffic is disabled in the service configuration. Verify the unencrypted traffic …
Run Code Online (Sandbox Code Playgroud)

powershell remoting powershell-2.0 powershell-remoting

23
推荐指数
2
解决办法
9万
查看次数

ASP.NET压力测试

有没有办法测试一个应用程序,您可以模拟连接到IIS服务器并询问相同数据的一百个不同客户端?在我们项目运行的客户,他们有400台计算机,他们经常对所有计算机进行压力测试.另一方面,我只有我的笔记本电脑......(和开发服务器).

(在我的例子中,数据是通过WebORB网关提出的).

asp.net session remoting stress-testing weborb

22
推荐指数
4
解决办法
2万
查看次数

在C#中通过远程处理获取外部IP地址

我需要找出运行C#应用程序的计算机的外部 IP.

在应用程序中,我有一个连接(通过.NET远程处理)到服务器.有没有一种很好的方法来获取服务器端的客户端地址?

(我已经编辑了这个问题,要更清楚一些.我向所有那些尽力回答这个问题的人道歉,当时我可能有点太模糊了)

解决方案:
我发现了一种对我有用的方法.通过实现我可以访问CommonTransportKeys.IPAddress的自定义IServerChannelSinkProvider和IServerChannelSink,可以很容易地在CallContext上添加客户端ip.

public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, 
    IMessage requestmessage, ITransportHeaders requestHeaders, 
    System.IO.Stream requestStream, out IMessage responseMessage, 
    out ITransportHeaders responseHeaders, out System.IO.Stream responseStream)
{
    try
    {
        // Get the IP address and add it to the call context.
        IPAddress ipAddr = (IPAddress)requestHeaders[CommonTransportKeys.IPAddress];
        CallContext.SetData("ClientIP", ipAddr);
    }
    catch (Exception)
    {
    }

    sinkStack.Push(this, null);
    ServerProcessing srvProc = _NextSink.ProcessMessage(sinkStack, requestmessage, requestHeaders,
        requestStream, out responseMessage, out responseHeaders, out responseStream);

    return srvProc;
}
Run Code Online (Sandbox Code Playgroud)

然后(当我从客户端收到请求时)只需从CallContext获取IP就像这样.

public string GetClientIP()
{
    // Get the client IP …
Run Code Online (Sandbox Code Playgroud)

.net c# remoting

20
推荐指数
4
解决办法
4万
查看次数

混合安全和不安全的渠道

一旦安全通道已经注册,我就无法使用不安全的通道.以下代码仅适用于客户端,以前注册的不安全通道.

是否可以混合安全和不安全的渠道而不对注册订单有任何限制?

using System;
using System.Collections;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class SampleObject : MarshalByRefObject
{
    public DateTime GetTest() { return DateTime.Now; }
}
public class SampleObject2 : MarshalByRefObject
{
    public DateTime GetTest2() { return DateTime.Now; }
}
static class ProgramClient
{
    private static TcpClientChannel RegisterChannel(bool secure, string name, int priority)
    {
        IDictionary properties = new Hashtable();
        properties.Add("secure", secure);
        properties.Add("name", name);
        properties.Add("priority", priority);
        var clientChannel = new TcpClientChannel(properties, null);
        ChannelServices.RegisterChannel(clientChannel, false);
        return clientChannel;
    }
    private static void Secure() …
Run Code Online (Sandbox Code Playgroud)

.net c# security remoting

19
推荐指数
1
解决办法
1356
查看次数

如何在VisualStudio 2008中调试__transparentProxy实例?

我正在研究一个调试主题,以改进__TransparentProxy从Unity解析实例的调试TransparentProxyInterceptor.

常见的调试方案是,当程序中断时,我希望在监视窗口或VS2008 IDE中的立即窗口中查看公共成员值或在代理程序包装的实例上调用该方法.

问题出现了:在我的代理包装实例上访问公共属性或调用方法时,我总是遇到Watch/Immediate窗口中显示的异常消息,

'无法在类型'MyDomainObject'的实例上获取字段或调用方法,因为它是远程对象的代理.

我已经挖掘了Web上的线程,并发现此异常的原因是由于.NET的内部反射行为__transparentProxy.的__transparentProxy实例不能在访问相应的属性/方法RealProxy例如在底层__transparentProxy实例本身.

AFAIK,有两种方式(没有外部工具的任何设计或帮助)来获得我想要的价值.一个是在Watch窗口中继续展开和展开私有成员值,经过几次点击后,我终于可以访问无需代理的原始实例,我可以在其上做任何我想做的事情.另一种方法更快,但每次要访问原始的未经处理的实例时仍需要花费一些精力:RemotingServices.GetRealProxy(myProxiedObject).Target

无论哪种方式都可行,但需要付出一些努力才能获得我想要的实例,而我想要的代理实例位于深层次结构中,继续展开或编写RemotingServices.GetRealProxy(myProxiedObject).Target(循环这个)非常繁琐.

我提出了两个解决方案,一个尝试从DebuggerTypeProxyAttribute.NET中获得一些帮助,但似乎没有这样做,因为我必须将此属性附加到RealProxy-derived类,我真的不想修改源代码InterceptingRealProxyUnity中的类代码.

另一种方式似乎是可行的,但我的课程设计有点扭曲.我添加了一个在我的代理包装的目标实例的基类中protected readonly调用的属性_rawInstance,因此我可以_rawInstance在我的监视窗口中看到它直接导致我原始的未包装对象.代码可能如下所示:

public class MyDomainBase : MarshalByRefObject
{
    protected MyDomainBase _rawInstance
    {
        get{ return this; }
    }

    (... some members, ignored)
}
Run Code Online (Sandbox Code Playgroud)

我想知道这个问题是否有更好的解决方案?任何信息或提示将非常感激.

debugging proxy remoting visual-studio

19
推荐指数
1
解决办法
4533
查看次数

什么是.NET中的渠道工厂?

什么是渠道工厂,为什么要使用它?

c# wcf remoting

18
推荐指数
2
解决办法
1万
查看次数

未找到请求的服务

我有一个使用远程工作的Windows服务应用程序.它用于显示气球尖端.但是,它有时会抛出此错误:

Exception :Requested Service not found
Inner Exception : Stack Trace : Server stack trace: at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Baloontip.clsBaloonTool.Messagebox(String Message)

任何人都可以帮我解决这个问题.

.net c# remoting .net-remoting

18
推荐指数
1
解决办法
8259
查看次数