Bug 18808 - WCF net tcp export metadata
Summary: WCF net tcp export metadata
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 3.0.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-04-03 23:15 UTC by Hugo Arevalo
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Source file to test the bug. (1.33 KB, text/x-csharp)
2014-04-03 23:15 UTC, Hugo Arevalo
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 18808 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Hugo Arevalo 2014-04-03 23:15:42 UTC
Created attachment 6491 [details]
Source file to test the bug.

Hi, I'm trying to export the metadata of a WCF nettcp service, the service works fine if I don't want to export metadata but It's a pain on the neck having to copy the assembly to the client application whenever I make a change on the server. I replicated a small example to show the exception I'm receiving. The application works just fine on Visual Studio.

In order to compile the service I run: gmcs -r:System.ServiceModel Main.cs
To run the service I just type: mono Main.exe
Comment 1 Hugo Arevalo 2014-04-04 11:03:07 UTC
Sorry, I forgot to comment that the address is set as localhost, I'll post the code also here.

using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace wcfservice
{
	public class Program
	{
		public static void Main(string[] args)
		{
			var uri = new Uri("net.tcp://localhost:9001/HelloService");
			var host = new ServiceHost(new HelloWorld(), uri);
			
			host.AddServiceEndpoint(typeof(IHelloWorld), new NetTcpBinding(SecurityMode.None), uri);
			ServiceMetadataBehavior smb = host.Description.Behaviors.Find<ServiceMetadataBehavior>();

			if (smb == null)
				smb = new ServiceMetadataBehavior();

			host.Description.Behaviors.Add(smb);

			host.AddServiceEndpoint(
				ServiceMetadataBehavior.MexContractName,
				MetadataExchangeBindings.CreateMexTcpBinding(),
				"mex");

			var behavior = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
			behavior.InstanceContextMode = InstanceContextMode.Single;
			host.Open();

			Console.WriteLine("Hosted {0}", DateTime.Now.ToString());
			Console.ReadKey();
		}	
	}

	[ServiceContract]
	public interface IHelloWorld
	{
		[OperationContract]
		string Hello(string Name);
	}
	[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, IncludeExceptionDetailInFaults=true,ConcurrencyMode=ConcurrencyMode.Reentrant)]
	public class HelloWorld : IHelloWorld
	{
		public string Hello(string Name)
		{
			return string.Format("Hello {0}", Name);
		}
	}
}