// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !MOBILE
using System;
using System.Globalization;
using System.Runtime.Serialization;
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 ();
#endregion
}
}
+#endif
\ No newline at end of file