Esempio n. 1
0
        public void InstanceWithSingletonMode_InheritServiceBehavior()
        {
            // # 37035

            var ep = NetworkHelpers.LocalEphemeralEndPoint().ToString();

            ChildSingletonService instance = new ChildSingletonService();
            ServiceHost           host     = new ServiceHost(instance);

            host.AddServiceEndpoint(typeof(SingletonService),
                                    new BasicHttpBinding(),
                                    new Uri("http://" + ep + "/s3"));

            try {
                host.Open();
            } catch (InvalidOperationException ex) {
                Assert.Fail("InstanceContextMode was not inherited from parent, exception was: {0}", ex);
            } finally {
                host.Close();
            }
        }
Esempio n. 2
0
		public void InstanceWithSingletonMode_InheritServiceBehavior ()
		{
			// # 37035

			var ep = NetworkHelpers.LocalEphemeralEndPoint ().ToString ();

			ChildSingletonService instance = new ChildSingletonService ();
			ServiceHost host = new ServiceHost (instance);

			host.AddServiceEndpoint (typeof (SingletonService),
						 new BasicHttpBinding (),
						 new Uri ("http://" + ep + "/s3"));

			try {
				host.Open ();
			} catch (InvalidOperationException ex) {
				Assert.Fail ("InstanceContextMode was not inherited from parent, exception was: {0}", ex);
			} finally {
				host.Close ();
			}
		}