Hi,
Facing issue with HttpChannel.... I have always used TcpChannel...us ing
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.microso ft.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 .RegisterChanne l(new HttpChannel(332 4),false);
//ChannelServices .RegisterChanne l(new TcpChannel(3324 ), false);
RemotingConfigu ration.Register WellKnownServic eType(Type.GetT ype("RemotingSe rver.TestClass,
RemotingServer" ), "RemotingServer ", WellKnownObject Mode.Singleton) ;
Console.WriteLi ne("Server Initialized");
Console.WriteLi ne("Press any key to exit");
Console.ReadKey ();
}
}
interface ITestInterface
{
void SayHello();
void OutputMessage(s tring msg);
}
class TestClass : MarshalByRefObj ect,ITestInterf ace
{
public void SayHello()
{
Console.WriteLi ne("Say Hello");
}
public void OutputMessage(s tring msg)
{
Console.WriteLi ne(msg);
}
}
}
=============== =============== ===========
And this is the client code
namespace RemotingServer
{
interface ITestInterface
{
void SayHello();
void OutputMessage(s tring msg);
}
}
namespace RemotingClient1
{
class Program
{
static void Main(string[] args)
{
object o =
RemotingService s.Connect(typeo f(RemotingServe r.ITestInterfac e),
@"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...us ing
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.microso ft.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 .RegisterChanne l(new HttpChannel(332 4),false);
//ChannelServices .RegisterChanne l(new TcpChannel(3324 ), false);
RemotingConfigu ration.Register WellKnownServic eType(Type.GetT ype("RemotingSe rver.TestClass,
RemotingServer" ), "RemotingServer ", WellKnownObject Mode.Singleton) ;
Console.WriteLi ne("Server Initialized");
Console.WriteLi ne("Press any key to exit");
Console.ReadKey ();
}
}
interface ITestInterface
{
void SayHello();
void OutputMessage(s tring msg);
}
class TestClass : MarshalByRefObj ect,ITestInterf ace
{
public void SayHello()
{
Console.WriteLi ne("Say Hello");
}
public void OutputMessage(s tring msg)
{
Console.WriteLi ne(msg);
}
}
}
=============== =============== ===========
And this is the client code
namespace RemotingServer
{
interface ITestInterface
{
void SayHello();
void OutputMessage(s tring msg);
}
}
namespace RemotingClient1
{
class Program
{
static void Main(string[] args)
{
object o =
RemotingService s.Connect(typeo f(RemotingServe r.ITestInterfac e),
@"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
Comment