我试图在2x 64位Windows机器之间建立基本的.NET Remoting通信.如果Machine1充当客户端而Machine2充当服务器,那么一切正常.发生以下异常的另一种方法是:
System.Net.Sockets.SocketException:无法建立连接,因为目标计算机主动拒绝它172.16.7.44:6666
服务器代码:
TcpChannel channel = new TcpChannel(6666);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(MyRemotableObject),"HelloWorld",WellKnownObjectMode.Singleton);
Run Code Online (Sandbox Code Playgroud)
客户端代码:
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
// Create an instance of the remote object
remoteObject = (MyRemotableObject)Activator.GetObject(
typeof(MyRemotableObject), "tcp://172.16.7.44:6666/HelloWorld");
Run Code Online (Sandbox Code Playgroud)
我的代码有什么问题吗?
我有一个在主机应用程序中创建的对象,可以使用远程访问远程访问它,有什么方法可以测试连接以确保它仍然"活着"?如果远程连接断开连接,或者某些可以告诉我远程连接状态的属性,也许我可以使用的事件会触发.有这样的东西吗?
我有一个非常简单的客户端 - 服务器应用程序,我用它来分隔两个不能在同一个进程中共存的组件.在开发它们时(服务器是一个exe,客户端是一个库),我所有的单元测试都像猪粪一样高兴.当我继续在其他地方重新使用库时,我得到以下异常:
System.Runtime.Remoting.RemotingException: An error occurred while processing the request on the server: System.Security.SecurityException: Cannot open an anonymous level security token.
at System.Security.Principal.WindowsIdentity.GetCurrentInternal(TokenAccessLevels desiredAccess, Boolean threadOnly)
at System.Security.Principal.WindowsIdentity.GetCurrent()
at System.Runtime.Remoting.Channels.Ipc.IpcServerTransportSink.ServiceRequest(Object state)
The Zone of the assembly that failed was:
MyComputer.
Run Code Online (Sandbox Code Playgroud)
我已经在代码中设置了双方的远程处理,而不是在此阶段为了简单而配置文件.它们实际上完全相同:
BinaryClientFormatterSinkProvider client = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider server = new BinaryServerFormatterSinkProvider();
server.TypeFilterLevel = TypeFilterLevel.Full;
Hashtable config = new Hashtable();
config["name"] = "SomeName";
config["portName"] = "SomePortName";
config["typeFilterLevel"] = "Full";
config["impersonate"] = "true";
config["tokenImpersonationLevel"] = "Impersonation";
config["useDefaultCredentials"] = "True";
config["secure"] = …Run Code Online (Sandbox Code Playgroud) .net中的com +替代品是什么?是.net远程处理还是WCF或其他东西.
这两个答案都是正确的,即使我认为我们可以使用远程处理和Web服务来实现com +的功能.或者甚至可以使用包装器来实现com +.但是我说的是有些东西可以解压缩com +,就像java中我们有EJB作为com +的替代品,是否有一些东西在.net中对抗com +?
我想要一个配置,我的构建服务器运行一个NUnit测试,打开并驱动远程机器上的浏览器.实现这一目标的最佳方法是什么?
在Selenium 1中很容易做到,因为java代理服务器位于测试和浏览器之间.在Selenium 2中,您的测试直接与浏览器通信(至少在IE和Firefox中).
有没有办法做到这一点?可能有WCF服务或其他什么?
我试图做一个简单的程序,以id的形式发送一个id并根据id获取数据。但是我一直收到这个错误。
Cannot load type 'remote.RemoteObjectClass, remoteclient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Run Code Online (Sandbox Code Playgroud)
服务器
TcpServerChannel channel = new TcpServerChannel(8086);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Class1), "1",
WellKnownObjectMode.Singleton);
label1.Text = "started";
Run Code Online (Sandbox Code Playgroud)
客户
RemoteObjectClass obj1 = (RemoteObjectClass)Activator.GetObject(
typeof(RemoteObjectClass),
"tcp://localhost:8086/1");
if (obj1 == null)
{
label1.Text = "Could not locate TCP server";
}
Class1 cl = obj1.kk(Convert.ToInt32(textBox1.Text)); -- **got error here**
Run Code Online (Sandbox Code Playgroud)
远程对象类
class RemoteObjectClass : System.MarshalByRefObject
{
public int c(int i)
{
return 33;
}
public Class1 kk(int i)
{
Class1 k = new Class1();
return k;
}
Run Code Online (Sandbox Code Playgroud)
类库
namespace ClassLibrary1 …Run Code Online (Sandbox Code Playgroud) 经过一些阅读,我收集.NET Remoting是一个已弃用的API,已被WCF取代.
我正在编写一个自动化框架,并希望在本地或某些远程机器上引用类型/方法的DLL,并执行它们而不考虑它们执行的位置.
我认为Remoting是要走的路,因为我猜所有功能都是在代理对象上执行的,如果它是本地对象或远程,则无关紧要.
WCF如何执行这种操作(如果有的话)或.NET Remoting是要走的路?
或许还有其他一些我没有想到的选择?
.Net Remoting是打开多个连接还是只打开一个连接?假设我有一台服务器和一台客户端.如果客户端创建多个SingleCall对象.那么对于每个对象,是否会有一个新的连接,或者每个对象都会有一个连接?
我无法在任何地方找到答案.
这个New-PSDrive命令
New-PSDrive -Name Z -PSProvider FileSystem -Root \\$j\share -Credential $credentials -ErrorAction Stop
Run Code Online (Sandbox Code Playgroud)
导致错误
New-PSDrive : Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the
server or shared resource and try again
Run Code Online (Sandbox Code Playgroud)
我尝试先断开所有驱动器,然后创建新驱动器,
net use * /delete /y
New-PSDrive -Name Z -PSProvider FileSystem -Root \\$j\share -Credential $credentials -ErrorAction Stop
Run Code Online (Sandbox Code Playgroud)
我得到了输出
You have these remote connections:
\\TSCLIENT\C
\\TSCLIENT\D
\\TSCLIENT\E
\\TSCLIENT\I
\\TSCLIENT\J
\\TSCLIENT\K
\\TSCLIENT\L
\\TSCLIENT\R …Run Code Online (Sandbox Code Playgroud) 在集群环境中,我有一个种子节点和node1和node2.
从node1我想发送一条消息给在node2上创建的Actor.node2上此节点的本地路径是akka:MyAkkaSystem/user/AnActor.
现在我想通过使用如下的ActorSelection从一个Actor从node1向这个特定的actor发送一条消息:
var actorSystem = ActorSystem.Create("MyTestSystem");
var c = actorSystem.ActorSelection("/user/ConsoleReceiver");
c.Tell("Hello World");
Run Code Online (Sandbox Code Playgroud)
在node2上,actor已经像这样创建:
var actorSystem = ActorSystem.Create("MyTestSystem");
var r = actorSystem.ActorOf(Props.Create<MessageReceiver>(), "ConsoleReceiver");
Console.WriteLine(r.Path);
Console.ReadLine();
actorSystem.Terminate().Wait();
Run Code Online (Sandbox Code Playgroud)
不幸的是,由于尝试以死信结束,因此无效.
node2上的HOCON配置如下所示:
akka {
actor {
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
deployment {
}
}
remote {
log-remote-lifecycle-events = DEBUG
log-received-messages = on
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
hostname = "127.0.0.1"
port = 0
}
}
cluster {
#will inject this node as a self-seed node at run-time …Run Code Online (Sandbox Code Playgroud)