Bug 40787 - WCF service with ExternalMetadataLocation doesn't work
Summary: WCF service with ExternalMetadataLocation doesn't work
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 4.2.0 (C6)
Hardware: Other Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-30 18:16 UTC by GT Hvidsten
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

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


Attachments
Service page generated by WCF with highlighting mentioned in the code example (47.91 KB, image/png)
2016-04-30 18:16 UTC, GT Hvidsten
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 40787 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 GT Hvidsten 2016-04-30 18:16:51 UTC
Created attachment 15873 [details]
Service page generated by WCF with highlighting mentioned in the code example

I'm running Mono on Raspbian, which apparently comes with version 3.2.8 when I install it (apt-get install mono-complete). I see now that this is not the latest version, but I'm not sure how I can upgrade it so that I can test this on a newer version.

I have created a WCF service that needs to present a specific WSDL file (for backwards compatibility). I tell WCF to tell the consumers of the service to use a specific WSDL file (instead of the one being generated by WCF).

In regular .Net on Windows (not using Mono) this works as in the attached screenshot.
The highlighted numbers point to examples in the code below:
#1 - The address the WCF service is set up to use
#2 - The WSDL referred to in the ExternalMetadataLocation property
Also, if you go to http://localhost:8080/myservice?wsdl you are redirected to the custom WSDL.

In Mono the WCF service just presents the autogenerated WSDL for the service, when it should instead present a link to the external WSDL file as well as redirect to the external file.


Example of how WCF is set up to use a specific WSDL file:
----------
MyService service = new MyService();
// See #1 in attached screenshot
ServiceHost host = new ServiceHost(service, new Uri("http://localhost:8080/myservice");
var behaviour = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
behaviour.InstanceContextMode = InstanceContextMode.Single;

ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
// See #2 in attached screenshot
smb.ExternalMetadataLocation = new Uri("http://localhost:8080/reachable/wsdl/myservice.wsdl", baseAddress.Scheme, baseAddress.Host, baseAddress.Port));
smb.HttpGetEnabled = true;

host.Description.Behaviors.Add(smb);

host.Open();
----------
Comment 1 GT Hvidsten 2016-05-01 10:24:47 UTC
I have now been able to upgrade to 4.0.2 and the issue is there as well.
Comment 2 GT Hvidsten 2016-05-08 18:51:32 UTC
Verified on 4.2.3.4