Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpascalhaakmat <pascalh@gmail.com>2018-03-21 20:09:45 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2018-03-21 20:09:45 +0300
commit3fa3592376c5c07ac163a2c7bb95b94c2931046b (patch)
treeb1d07a36d57f5de6327f51383a3080c4abe91d4d /mcs/class/System.ServiceModel
parentf42fdeca61b74998416900170e24531d45343914 (diff)
Uncomment and fix ServiceHost creation via ServiceFactory in SvcHttpHandler.cs (#3465)
This commit allows customization of WCF service creation via the Factory attribute in an .svc file: `<%@ ServiceHost Language="C#" Service="CustomService" Factory="CustomServiceHostFactory" %>` All the patch does is uncomment a few lines that were already there and fix a small error. I am not sure why these lines were commented. Possibly the code is not sufficiently robust or it was just never given another look. But this works for me and it seems better than no support at all. For example, a custom ServiceHostFactory appears to be the only way to create a WCF service in a managed host which customizes EndpointDispatcher.AddressFilter and EndpointDispatcher.ContractFilter. This in turn is useful for proxied WCF services. See also http://mono.1490590.n4.nabble.com/Mono-WCF-ServiceHost-Factory-option-td4251992.html (from 2012; never posted on the mailing list for some reason).
Diffstat (limited to 'mcs/class/System.ServiceModel')
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs
index 6148eb46242..3cd0860de83 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs
@@ -128,10 +128,10 @@ namespace System.ServiceModel.Channels
//ServiceHost for this not created yet
var baseUri = new Uri (new Uri (HttpContext.Current.Request.Url.GetLeftPart (UriPartial.Authority)), path);
-// if (factory_type != null) {
-// host = ((ServiceHostFactory) Activator.CreateInstance (factory_type)).CreateServiceHost (type, new Uri [] {baseUri});
-// }
-// else
+ if (factory_type != null) {
+ host = ((ServiceHostFactory) Activator.CreateInstance (factory_type)).CreateServiceHost (type.ToString(), new Uri [] {baseUri});
+ }
+ else
host = new ServiceHost (type, baseUri);
host.Extensions.Add (new VirtualPathExtension (baseUri.AbsolutePath));