+2009-08-31 Atsushi Enomoto <atsushi@ximian.com>
+
+ * HttpChannelFactory.cs : reject URI mismatch cases when required.
+
2009-08-26 Atsushi Enomoto <atsushi@ximian.com>
* PeerDuplexChannel.cs : When received Connect() from neighbor,
if (source.Scheme != address.Uri.Scheme)
throw new ArgumentException (String.Format ("Argument EndpointAddress has unsupported URI scheme: {0}", address.Uri.Scheme));
+ if (MessageEncoder.MessageVersion.Addressing.Equals (AddressingVersion.None) &&
+ !address.Uri.Equals (via))
+ throw new ArgumentException (String.Format ("The endpoint address '{0}' and via uri '{1}' must match when the corresponding binding has addressing version in the message version value as None.", address.Uri, via));
+
Type t = typeof (TChannel);
if (t == typeof (IRequestChannel))
return (TChannel) (object) new HttpRequestChannel ((HttpChannelFactory<IRequestChannel>) (object) this, address, via);
using System.IO;
using System.Net;
using System.Net.Security;
+using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
new BasicHttpBinding ().BuildChannelListener<IReplyChannel> (new BindingParameterCollection ());
}
+ // when AddressingVersion is None (in MessageVersion), then
+ // EndpointAddress.Uri and via URIs must match.
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void EndpointAddressAndViaMustMatchOnAddressingNone ()
+ {
+ try {
+ var ch = ChannelFactory<IFoo>.CreateChannel (new BasicHttpBinding (), new EndpointAddress ("http://localhost:37564/"), new Uri ("http://localhost:8080/HogeService"));
+ ((ICommunicationObject) ch).Close ();
+ } catch (TargetInvocationException) {
+ // we throw this exception so far. Since it is
+ // very internal difference (channel is created
+ // inside ClientRuntimeChannel.ctor() while .NET
+ // does it in ChannelFactory<T>.CreateChannel(),
+ // there is no point of treating it as failure).
+ throw new ArgumentException ();
+ }
+ }
+
+ #region contracts
+
+ [ServiceContract]
+ interface IFoo
+ {
+ [OperationContract]
+ string DoWork (string s1, string s2);
+ }
+
+ #endregion
+
#region connection test
string svcret;