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
Depends on:
Reported: 2016-04-30 18:16 UTC by GT Hvidsten
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

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

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

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;


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

Note You need to log in before you can comment on or make changes to this bug.