[Mono-dev] WCF: Contracts with Interface hierarchy
Karsten Fourmont
fourmont at gmx.de
Sun Nov 28 12:58:29 EST 2010
Hi Atsushi,
thank you for the "WCF Interface Hierarchy" fix. Works great...
well unless you have a Microsoft.NET client and a Mono server.
Then you get (in the Mono server):
System.ServiceModel.ActionNotSupportedException: Action
'http://tempuri.org/IFoo/Foo' did not match any operations in the target
contract at
System.ServiceModel.Dispatcher.ListenerLoopManager.FindEndpointDispatcher (
System.ServiceModel.Channels.Message message) [0x00000] in <filename
unknown>:0
at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessInput
(IInputChan
nel input, System.ServiceModel.Channels.Message message) [0x00000] in
<filename
unknown>:0
It seems the naming scheme differs.
I tested it with 2.8.1 and the System.ServiceModel.dll from daily builds
(seems your patch didn't make it into 2.8.1). Hope it's not this
combination that causes the issue.
Here's some testcode. Invoke without arguments using Mono to start the
server and then with "-client" using MS.NET to reproduce the error.
Runinng both client and server with Mono works fine.
------------8<-----------------------
using System;
using System.ServiceModel;
namespace TestServer
{
[ServiceContract]
interface IServiceInterface : IFoo
{
}
[ServiceContract]
interface IFoo : IBar
{
[OperationContract] string Foo();
}
[ServiceContract]
interface IBar
{
[OperationContract] string FooBar();
}
class TestWcf : IServiceInterface
{
public string FooBar()
{
return "FooBar";
}
public string Foo()
{
return "Foo";
}
private static readonly Uri addrress = new
Uri("net.tcp://localhost:9999/test");
public static ServiceHost TestServer()
{
var host = new ServiceHost(typeof(TestWcf), addrress);
host.AddServiceEndpoint(typeof(IServiceInterface), new
NetTcpBinding(SecurityMode.None), addrress);
host.Open();
return host;
}
public static void TestClient()
{
ChannelFactory<IServiceInterface> factory = new
ChannelFactory<IServiceInterface>(new NetTcpBinding(SecurityMode.None),
addrress.ToString());
var channel = factory.CreateChannel();
Console.WriteLine(channel.Foo());
Console.WriteLine(channel.FooBar());
factory.Close();
}
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "-client")
{
Console.WriteLine("Running client");
TestClient();
}
else
{
TestServer();
Console.WriteLine("Running server. Hit key");
Console.ReadKey();
}
}
}
}
More information about the Mono-devel-list
mailing list