コード例 #1
0
 /// <summary>
 /// Configure the WSDL generation for the endpoints
 /// </summary>
 private void InjectFlatWsdlExtension()
 {
     foreach (ServiceEndpoint endpoint in this.Description.Endpoints)
     {
         WsdlExtensionsConfig config = new WsdlExtensionsConfig();
         config.SingleFile = true;
         //See if we have an override URL to use in the WSDL
         string customBaseUrl = Properties.Settings.Default.WcfBaseUrl;
         if (!String.IsNullOrEmpty(customBaseUrl))
         {
             //Add on the service URL to the base URI
             //We need to get the part of the service afer the host name and app-path
             string vdir = HttpContext.Current.Request.ApplicationPath;
             string serviceUrl;
             if (vdir == "/")
             {
                 serviceUrl = customBaseUrl + endpoint.Address.Uri.PathAndQuery;
             }
             else
             {
                 serviceUrl = endpoint.Address.Uri.PathAndQuery.Replace(vdir, customBaseUrl);
             }
             config.Location = new Uri(serviceUrl);
         }
         endpoint.Behaviors.Add(new WsdlExtensions(config));
     }
 }
コード例 #2
0
 internal WsdlExtensions(WsdlExtensionsConfig config)
 {
     this.Location   = config.Location;
     this.SingleFile = config.SingleFile;
 }