I have this code I am implemented from this azure wcf relay
I am getting this exception when sending a message bigger than 64K (with smaller message it works OK):
System.ServiceModel.CommunicationException: 'The maximum message size quota for incoming messages has been exceeded for the remote channel. See the server logs for more details.
the quota is unlimited in NetTcpRelayBinding according to this quota web page
here is my code
class WCFRelay
{
[ServiceContract(Namespace = "urn:ps")]
interface IProblemSolver
{
[OperationContract]
int Test(byte[] bytes);
}
class ProblemSolver : IProblemSolver
{
public int Test(byte[] bytes)
{
return bytes.Length;
}
}
interface IProblemSolverChannel : IProblemSolver, IClientChannel { }
public static void CreateClient()
{
var cf = new ChannelFactory<IProblemSolverChannel>(
new NetTcpRelayBinding(),
new EndpointAddress(ServiceBusEnvironment.CreateServiceUri("sb", "...", "solver")));
cf.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior
{ TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "...") });
using (var ch = cf.CreateChannel())
{
// if its 50K its ok - if its 70K i get exception
Console.WriteLine(ch.Test(new byte[1000 * 70]));
}
}
public static void CreateServer()
{
ServiceHost sh = new ServiceHost(typeof(ProblemSolver));
sh.AddServiceEndpoint(
typeof(IProblemSolver), new NetTcpRelayBinding(),
ServiceBusEnvironment.CreateServiceUri("sb", "...", "solver"))
.Behaviors.Add(new TransportClientEndpointBehavior
{
TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "...")
});
sh.Open();
while (true)
{
Thread.Sleep(1000);
}
Console.WriteLine("Press ENTER to close");
Console.ReadLine();
sh.Close();
}
}