using System.Xml;
using NUnit.Framework;
+using MonoTests.Helpers;
+
namespace MonoTests.System.ServiceModel.Dispatcher
{
[TestFixture]
public void WebMessageFormats ()
{
var host = new WebServiceHost (typeof (Hello));
- host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:37564/");
+ var port = NetworkHelpers.FindFreePort ();
+ host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:" + port + "/");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
host.Open ();
try {
// run client
- using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:37564/"))
+ using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:" + port + "/"))
{
factory.Endpoint.Behaviors.Add (new WebHttpBehavior ());
IHello h = factory.CreateChannel ();