A
Ashutosh
Hi,
Facing issue with HttpChannel....I have always used TcpChannel...using
it for the first time..
This code works fine for TcpChannel but gives exception when using
HttpChannel on calling the SayHello method in client. Exception details:
"Invalid SOAPAction specified:
"http://schemas.microsoft.com/clr/nsassem/RemotingServer.ITestInterface/RemotingClient1#SayHello""
Do we need to do something extra here to use HttpChannel? I have tried
applying SoapMethod attributes to the method and/or SoapType to the
class & interface.
I have this simple server code....
namespace RemotingServer
{
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new HttpChannel(3324),false);
//ChannelServices.RegisterChannel(new TcpChannel(3324), false);
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("RemotingServer.TestClass,
RemotingServer"), "RemotingServer", WellKnownObjectMode.Singleton);
Console.WriteLine("Server Initialized");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
interface ITestInterface
{
void SayHello();
void OutputMessage(string msg);
}
class TestClass : MarshalByRefObject,ITestInterface
{
public void SayHello()
{
Console.WriteLine("Say Hello");
}
public void OutputMessage(string msg)
{
Console.WriteLine(msg);
}
}
}
=========================================
And this is the client code
namespace RemotingServer
{
interface ITestInterface
{
void SayHello();
void OutputMessage(string msg);
}
}
namespace RemotingClient1
{
class Program
{
static void Main(string[] args)
{
object o =
RemotingServices.Connect(typeof(RemotingServer.ITestInterface),
@"http://localhost:3324/RemotingServer", null);
RemotingServer.ITestInterface t = o as
RemotingServer.ITestInterface;
if (t != null)
{
t.SayHello();
t.OutputMessage("Hi From Client");
}
Console.ReadKey();
}
}
}
Can someone please point out the problem here?
Thanks & Regards,
Ashutosh
Facing issue with HttpChannel....I have always used TcpChannel...using
it for the first time..
This code works fine for TcpChannel but gives exception when using
HttpChannel on calling the SayHello method in client. Exception details:
"Invalid SOAPAction specified:
"http://schemas.microsoft.com/clr/nsassem/RemotingServer.ITestInterface/RemotingClient1#SayHello""
Do we need to do something extra here to use HttpChannel? I have tried
applying SoapMethod attributes to the method and/or SoapType to the
class & interface.
I have this simple server code....
namespace RemotingServer
{
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new HttpChannel(3324),false);
//ChannelServices.RegisterChannel(new TcpChannel(3324), false);
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("RemotingServer.TestClass,
RemotingServer"), "RemotingServer", WellKnownObjectMode.Singleton);
Console.WriteLine("Server Initialized");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
interface ITestInterface
{
void SayHello();
void OutputMessage(string msg);
}
class TestClass : MarshalByRefObject,ITestInterface
{
public void SayHello()
{
Console.WriteLine("Say Hello");
}
public void OutputMessage(string msg)
{
Console.WriteLine(msg);
}
}
}
=========================================
And this is the client code
namespace RemotingServer
{
interface ITestInterface
{
void SayHello();
void OutputMessage(string msg);
}
}
namespace RemotingClient1
{
class Program
{
static void Main(string[] args)
{
object o =
RemotingServices.Connect(typeof(RemotingServer.ITestInterface),
@"http://localhost:3324/RemotingServer", null);
RemotingServer.ITestInterface t = o as
RemotingServer.ITestInterface;
if (t != null)
{
t.SayHello();
t.OutputMessage("Hi From Client");
}
Console.ReadKey();
}
}
}
Can someone please point out the problem here?
Thanks & Regards,
Ashutosh